Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Print proper title for provider type in API

Jan Sandbrink27b7b9590691
diff --git a/docs/api/apiv3/components/schemas/storage_read_model.yml b/docs/api/apiv3/components/schemas/storage_read_model.yml
index d716e739741..494bd0b81eb 100644
--- a/docs/api/apiv3/components/schemas/storage_read_model.yml
+++ b/docs/api/apiv3/components/schemas/storage_read_model.yml
@@ -72,7 +72,10 @@ properties:
allOf:
- $ref: './link.yml'
- description: |-
- The urn of the storage type. Currently only nextcloud storages are supported.
+ The urn of the storage type. Currently Nextcloud and OneDrive storages are supported.
+
+ - urn:openproject-org:api:v3:storages:Nextcloud
+ - urn:openproject-org:api:v3:storages:OneDrive
**Resource**: N/A
origin:
diff --git a/docs/api/apiv3/components/schemas/storage_write_model.yml b/docs/api/apiv3/components/schemas/storage_write_model.yml
index 441e422e82c..d7e93dd87c6 100644
--- a/docs/api/apiv3/components/schemas/storage_write_model.yml
+++ b/docs/api/apiv3/components/schemas/storage_write_model.yml
@@ -31,9 +31,10 @@ properties:
allOf:
- $ref: './link.yml'
- description: |-
- The urn of the storage type. Currently only nextcloud storages are supported.
+ The urn of the storage type. Currently Nextcloud and OneDrive storages are supported.
- urn:openproject-org:api:v3:storages:Nextcloud
+ - urn:openproject-org:api:v3:storages:OneDrive
**Resource**: N/A
diff --git a/modules/storages/lib/api/v3/storages/storage_representer.rb b/modules/storages/lib/api/v3/storages/storage_representer.rb
index f569b343140..1d813c1724c 100644
--- a/modules/storages/lib/api/v3/storages/storage_representer.rb
+++ b/modules/storages/lib/api/v3/storages/storage_representer.rb
@@ -125,7 +125,7 @@ module API::V3::Storages
getter: ->(*) {
type = STORAGE_TYPE_URN_MAP[represented.provider_type] || represented.provider_type
- { href: type, title: "Nextcloud" }
+ { href: type, title: type.split(":").last }
},
setter: ->(fragment:, **) {
href = fragment["href"]
diff --git a/modules/storages/spec/lib/api/v3/storages/storages_representer_rendering_spec.rb b/modules/storages/spec/lib/api/v3/storages/storages_representer_rendering_spec.rb
index 72736e26c8d..63e71b3b993 100644
--- a/modules/storages/spec/lib/api/v3/storages/storages_representer_rendering_spec.rb
+++ b/modules/storages/spec/lib/api/v3/storages/storages_representer_rendering_spec.rb
@@ -87,6 +87,14 @@ RSpec.describe API::V3::Storages::StorageRepresenter, "rendering" do
end
end
+ describe "type" do
+ it_behaves_like "has a titled link" do
+ let(:link) { "type" }
+ let(:href) { "urn:openproject-org:api:v3:storages:#{storage.provider_type_nextcloud? ? 'Nextcloud' : 'OneDrive'}" }
+ let(:title) { storage.provider_type_nextcloud? ? "Nextcloud" : "OneDrive" }
+ end
+ end
+
describe "authorizationState" do
it_behaves_like "has a titled link" do
let(:link) { "authorizationState" }