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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#49124] Implement open links for storages, file links
Eric Schubert90e34623660b
diff --git a/frontend/src/app/shared/components/storages/icons.mapping.ts b/frontend/src/app/shared/components/storages/icons.mapping.tsindex f70036089b2..01ff93fbd3f 100644--- a/frontend/src/app/shared/components/storages/icons.mapping.ts+++ b/frontend/src/app/shared/components/storages/icons.mapping.ts@@ -107,5 +107,5 @@ export const fileIconMappings:Record<string, IFileIcon> = {export const storageIconMappings:Record<string, string> = {[nextcloud]: 'nextcloud-circle',- default: 'ticket',+ default: 'hosting',};diff --git a/frontend/src/app/shared/components/storages/storage/storage.component.html b/frontend/src/app/shared/components/storages/storage/storage.component.htmlindex ce0962680bc..2bacde5f4c1 100644--- a/frontend/src/app/shared/components/storages/storage/storage.component.html+++ b/frontend/src/app/shared/components/storages/storage/storage.component.html@@ -3,7 +3,7 @@><div class=op-tab-content--header><span- class="op-tab-content--header-icon spot-icon spot-icon_nextcloud-circle op-files-tab--icon op-files-tab--icon_primary"+ class="op-tab-content--header-icon spot-icon spot-icon_{{icon.storageHeader((storage | async)?._links.type.href)}} op-files-tab--icon op-files-tab--icon_primary"></span><span class="op-tab-content--header-text" [textContent]="(storage | async)?.name"></span><adiff --git a/frontend/src/app/shared/components/storages/storage/storage.component.ts b/frontend/src/app/shared/components/storages/storage/storage.component.tsindex 36efddd4412..46afadc4fc3 100644--- a/frontend/src/app/shared/components/storages/storage/storage.component.ts+++ b/frontend/src/app/shared/components/storages/storage/storage.component.ts@@ -99,6 +99,7 @@ import {StorageInformationService,} from 'core-app/shared/components/storages/storage-information/storage-information.service';import { storageLocaleString } from 'core-app/shared/components/storages/functions/storages.functions';+import { storageIconMappings } from 'core-app/shared/components/storages/icons.mapping';@Component({selector: 'op-storage',@@ -131,6 +132,10 @@ export class StorageComponent extends UntilDestroyedMixin implements OnInit, OnDdragging = 0;+ icon = {+ storageHeader: (storageType:string) => storageIconMappings[storageType] || storageIconMappings.default,+ };+text = {actions: {linkExisting: this.i18n.t('js.storages.link_existing_files'),diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud.rbindex 11a4d3c592b..1ca2ebd3c0c 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud.rb@@ -43,6 +43,7 @@ module Storagesregister(:propfind, Internal::PropfindQuery)register(:group_users, GroupUsersQuery)register(:upload_link, UploadLinkQuery)+ register(:open_link, OpenLinkQuery)endenddiff --git a/modules/storages/app/common/storages/peripherals/storage_url_helper.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/open_link_query.rbsimilarity index 62%rename from modules/storages/app/common/storages/peripherals/storage_url_helper.rbrename to modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/open_link_query.rbindex 54c435b0992..57ff7cc70cc 100644--- a/modules/storages/app/common/storages/peripherals/storage_url_helper.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/open_link_query.rb@@ -1,3 +1,5 @@+# frozen_string_literal: true+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2023 the OpenProject GmbH@@ -26,19 +28,28 @@# See COPYRIGHT and LICENSE files for more details.#++-module Storages::Peripherals- # Helper for open links for a file link object.- module StorageUrlHelper- module_function+module Storages+ module Peripherals+ module StorageInteraction+ module Nextcloud+ class OpenLinkQuery+ def initialize(storage)+ @uri = storage.uri+ end- def storage_url_open_file(storage, file_id, open_location: false)- location_flag = ActiveModel::Type::Boolean.new.cast(open_location) ? 0 : 1+ def self.call(storage:, user:, file_id:, open_location: false)+ new(storage).call(user:, file_id:, open_location:)+ end- "#{storage.host}/index.php/f/#{file_id}?openfile=#{location_flag}"- end+ # rubocop:disable Lint/UnusedMethodArgument+ def call(user:, file_id:, open_location: false)+ location_flag = open_location ? 0 : 1+ ServiceResult.success(result: "#{@uri}/index.php/f/#{file_id}?openfile=#{location_flag}")+ end- def storage_url_open(storage)- "#{storage.host}/index.php/apps/files"+ # rubocop:enable Lint/UnusedMethodArgument+ end+ endendendenddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive.rbindex 60096478dfd..96b350cb1cf 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive.rb@@ -37,6 +37,8 @@ module Storagesregister(:files, FilesQuery)register(:file_info, FileInfoQuery)register(:files_info, FilesInfoQuery)+ register(:open_link, OpenLinkQuery)+ register(:open_drive_link, OpenDriveLinkQuery)endendenddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/file_info_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/file_info_query.rbindex 642c9e67f8e..5d3a5a99a46 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/file_info_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/file_info_query.rb@@ -33,58 +33,22 @@ module Storagesmodule StorageInteractionmodule OneDriveclass FileInfoQuery- using ServiceResultRefinements+ FIELDS = %w[id name fileSystemInfo file size createdBy lastModifiedBy parentReference].freezedef self.call(storage:, user:, file_id:)new(storage).call(user:, file_id:)enddef initialize(storage)- @storage = storage- @uri = storage.uri+ @delegate = Internal::DriveItemQuery.new(storage)enddef call(user:, file_id:)- Util.using_user_token(@storage, user) do |token|- make_file_request(file_id, token).map(&storage_file_infos)- end+ @delegate.call(user:, drive_item_id: file_id, fields: FIELDS).map(&storage_file_infos)endprivate- def make_file_request(file_id, token)- response_data = Net::HTTP.start(@uri.host, @uri.port, use_ssl: true) do |http|- http.get(uri_path_for(file_id), { 'Authorization' => "Bearer #{token.access_token}" })- end-- handle_responses(response_data)- end-- def handle_responses(response)- json = MultiJson.load(response.body, symbolize_keys: true)-- case response- when Net::HTTPSuccess- ServiceResult.success(result: json)- when Net::HTTPNotFound- ServiceResult.failure(result: :not_found,- errors: ::Storages::StorageError.new(code: :not_found, data: json))- when Net::HTTPForbidden- ServiceResult.failure(result: :forbidden,- errors: ::Storages::StorageError.new(code: :forbidden, data: json))- when Net::HTTPUnauthorized- ServiceResult.failure(result: :unauthorized,- errors: ::Storages::StorageError.new(code: :unauthorized, data: json))- else- ServiceResult.failure(result: :error,- errors: ::Storages::StorageError.new(code: :error, data: json))- end- end-- def uri_path_for(file_id)- "/v1.0/drives/#{@storage.drive_id}/items/#{file_id}"- end-def storage_file_infos->(json) doStorageFileInfo.new(@@ -106,10 +70,6 @@ module Storages)endend-- def parse_json(str)- MultiJson.load(str, symbolize_keys: true)- endendendenddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/internal/drive_item_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/internal/drive_item_query.rbnew file mode 100644index 00000000000..ab1ee734caf--- /dev/null+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/internal/drive_item_query.rb@@ -0,0 +1,71 @@+# frozen_string_literal: true++module Storages+ module Peripherals+ module StorageInteraction+ module OneDrive+ module Internal+ class DriveItemQuery+ UTIL = ::Storages::Peripherals::StorageInteraction::OneDrive::Util++ def self.call(storage:, user:, drive_item_id:, fields: [])+ new(storage).call(user:, drive_item_id:, fields:)+ end++ def initialize(storage)+ @storage = storage+ @uri = storage.uri+ end++ def call(user:, drive_item_id:, fields: [])+ select_url_query = if fields.empty?+ ''+ else+ "?$select=#{fields.join(',')}"+ end++ UTIL.using_user_token(@storage, user) do |token|+ make_file_request(drive_item_id, token, select_url_query)+ end+ end++ private++ def make_file_request(drive_item_id, token, select_url_query)+ response_data = Net::HTTP.start(@uri.host, @uri.port, use_ssl: true) do |http|+ http.get(uri_path_for(drive_item_id) + select_url_query, { 'Authorization' => "Bearer #{token.access_token}" })+ end++ handle_responses(response_data)+ end++ def handle_responses(response)+ json = MultiJson.load(response.body, symbolize_keys: true)++ case response+ when Net::HTTPSuccess+ ServiceResult.success(result: json)+ when Net::HTTPNotFound+ ServiceResult.failure(result: :not_found,+ errors: ::Storages::StorageError.new(code: :not_found, data: json))+ when Net::HTTPForbidden+ ServiceResult.failure(result: :forbidden,+ errors: ::Storages::StorageError.new(code: :forbidden, data: json))+ when Net::HTTPUnauthorized+ ServiceResult.failure(result: :unauthorized,+ errors: ::Storages::StorageError.new(code: :unauthorized, data: json))+ else+ ServiceResult.failure(result: :error,+ errors: ::Storages::StorageError.new(code: :error, data: json))+ end+ end++ def uri_path_for(file_id)+ "/v1.0/drives/#{@storage.drive_id}/items/#{file_id}"+ end+ end+ end+ end+ end+ end+enddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_drive_link_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_drive_link_query.rbnew file mode 100644index 00000000000..68d48ad46e9--- /dev/null+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_drive_link_query.rb@@ -0,0 +1,95 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2023 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module Storages+ module Peripherals+ module StorageInteraction+ module OneDrive+ class OpenDriveLinkQuery+ def self.call(storage:, user:)+ new(storage).call(user:)+ end++ def initialize(storage)+ @storage = storage+ @uri = storage.uri+ end++ def call(user:)+ Util.using_user_token(@storage, user) do |token|+ make_request(token).map(&web_url)+ end+ end++ private++ def make_request(token)+ response_data = Net::HTTP.start(@uri.host, @uri.port, use_ssl: true) do |http|+ http.get(drive_uri_path, { 'Authorization' => "Bearer #{token.access_token}" })+ end++ handle_responses(response_data)+ end++ def handle_responses(response)+ json = MultiJson.load(response.body, symbolize_keys: true)++ case response+ when Net::HTTPSuccess+ ServiceResult.success(result: json)+ when Net::HTTPNotFound+ ServiceResult.failure(result: :not_found,+ errors: ::Storages::StorageError.new(code: :not_found, data: json))+ when Net::HTTPForbidden+ ServiceResult.failure(result: :forbidden,+ errors: ::Storages::StorageError.new(code: :forbidden, data: json))+ when Net::HTTPUnauthorized+ ServiceResult.failure(result: :unauthorized,+ errors: ::Storages::StorageError.new(code: :unauthorized, data: json))+ else+ ServiceResult.failure(result: :error,+ errors: ::Storages::StorageError.new(code: :error, data: json))+ end+ end++ def drive_uri_path+ "/v1.0/drives/#{@storage.drive_id}?$select=webUrl"+ end++ def web_url+ ->(json) do+ json[:webUrl]+ end+ end+ end+ end+ end+ end+enddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_link_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_link_query.rbnew file mode 100644index 00000000000..acdff069b05--- /dev/null+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_link_query.rb@@ -0,0 +1,63 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2023 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module Storages+ module Peripherals+ module StorageInteraction+ module OneDrive+ class OpenLinkQuery+ def self.call(storage:, user:, file_id:, open_location: false)+ new(storage).call(user:, file_id:, open_location:)+ end++ def initialize(storage)+ @delegate = Internal::DriveItemQuery.new(storage)+ end++ # TODO: open in location+ # rubocop:disable Lint/UnusedMethodArgument+ def call(user:, file_id:, open_location: false)+ @delegate.call(user:, drive_item_id: file_id, fields: %w[webUrl]).map(&web_url)+ end++ # rubocop:enable Lint/UnusedMethodArgument++ private++ def web_url+ ->(json) do+ json[:webUrl]+ end+ end+ end+ end+ end+ end+enddiff --git a/modules/storages/app/models/storages/nextcloud_storage.rb b/modules/storages/app/models/storages/nextcloud_storage.rbindex 922a0a7f966..c31f8810bba 100644--- a/modules/storages/app/models/storages/nextcloud_storage.rb+++ b/modules/storages/app/models/storages/nextcloud_storage.rb@@ -49,7 +49,7 @@ module Storagestransaction: false) dowhere("provider_fields->>'automatically_managed' = 'true'").includes(:oauth_client)- .each do |storage|+ .find_each do |storage|GroupFolderPropertiesSyncService.new(storage).callendtrue@@ -60,6 +60,10 @@ module StoragesPeripherals::OAuthConfigurations::NextcloudConfiguration.new(self)end+ def open_link+ File.join(uri.to_s, 'index.php/apps/files')+ end+def automatic_management_unspecified?automatically_managed.nil?enddiff --git a/modules/storages/app/models/storages/one_drive_storage.rb b/modules/storages/app/models/storages/one_drive_storage.rbindex ae57f9b1f3c..3fa5f7e8fe3 100644--- a/modules/storages/app/models/storages/one_drive_storage.rb+++ b/modules/storages/app/models/storages/one_drive_storage.rb@@ -33,6 +33,8 @@ module Storagesstore_attribute :provider_fields, :tenant_id, :string, default: 'consumers'store_attribute :provider_fields, :drive_id, :string+ using ::Storages::Peripherals::ServiceResultRefinements+def configuration_checks{ storage_oauth_client_configured: oauth_client.present? }end@@ -44,5 +46,14 @@ module Storagesdef uriURI('https://graph.microsoft.com').normalizeend++ def open_link+ ::Storages::Peripherals::Registry.resolve("queries.one_drive.open_drive_link")+ .call(storage: self, user: User.current)+ .match(+ on_success: ->(web_url) { web_url },+ on_failure: ->(*) { '' }+ )+ endendenddiff --git a/modules/storages/app/models/storages/project_storage.rb b/modules/storages/app/models/storages/project_storage.rbindex 713e2ea3d3c..24b544dccf5 100644--- a/modules/storages/app/models/storages/project_storage.rb+++ b/modules/storages/app/models/storages/project_storage.rb@@ -31,7 +31,8 @@# WorkPackages in the project.# See also: file_link.rb and storage.rbclass Storages::ProjectStorage < ApplicationRecord- # ProjectStorage sits between Project and Storage.+ using Storages::Peripherals::ServiceResultRefinements+belongs_to :project, touch: truebelongs_to :storage, touch: true, class_name: 'Storages::Storage'belongs_to :creator, class_name: 'User'@@ -63,11 +64,22 @@ class Storages::ProjectStorage < ApplicationRecordescaped_file_path.match?(%r|^/#{project_folder_path_escaped}|)end+ def open_link+ if project_folder_inactive?+ storage.open_link+ else+ call = ::Storages::Peripherals::Registry.resolve("queries.#{storage.short_provider_type}.open_link")+ .call(storage:, user: User.current, file_id: project_folder_id)+ call.match(+ on_success: ->(url) { url },+ on_failure: ->(*) { storage.open_link }+ )+ end+ end+privatedef escape_path(path)- ::Storages::Peripherals::StorageInteraction::Nextcloud::Util.escape_path(- path- )+ ::Storages::Peripherals::StorageInteraction::Nextcloud::Util.escape_path(path)endenddiff --git a/modules/storages/app/models/storages/storage.rb b/modules/storages/app/models/storages/storage.rbindex ab9f6c54c1b..1bcb79a1035 100644--- a/modules/storages/app/models/storages/storage.rb+++ b/modules/storages/app/models/storages/storage.rb@@ -110,6 +110,10 @@ module StoragesURI(host).normalizeend+ def open_link+ raise Errors::SubclassResponsibility+ end+def oauth_configurationraise Errors::SubclassResponsibilityenddiff --git a/modules/storages/lib/api/v3/file_links/file_link_representer.rb b/modules/storages/lib/api/v3/file_links/file_link_representer.rbindex 88af64f2e06..485167bad0e 100644--- a/modules/storages/lib/api/v3/file_links/file_link_representer.rb+++ b/modules/storages/lib/api/v3/file_links/file_link_representer.rb@@ -50,7 +50,6 @@ module API::V3::FileLinksinclude API::Decorators::LinkedResourceinclude API::Decorators::DatePropertyinclude ::API::Caching::CachedRepresenter- include Storages::Peripherals::StorageUrlHelperproperty :id@@ -90,24 +89,12 @@ module API::V3::FileLinksPERMISSION_LINKS[represented.origin_permission]end- link :originOpen do- {- href: storage_url_open_file(represented.storage, represented.origin_id)- }- end-link :staticOriginOpen do{href: api_v3_paths.file_link_open(represented.id)}end- link :originOpenLocation do- {- href: storage_url_open_file(represented.storage, represented.origin_id, open_location: true)- }- end-link :staticOriginOpenLocation do{href: api_v3_paths.file_link_open(represented.id, true)diff --git a/modules/storages/lib/api/v3/file_links/file_links_download_api.rb b/modules/storages/lib/api/v3/file_links/file_links_download_api.rbindex d8e014cefb1..45b4d316bf0 100644--- a/modules/storages/lib/api/v3/file_links/file_links_download_api.rb+++ b/modules/storages/lib/api/v3/file_links/file_links_download_api.rb@@ -30,7 +30,7 @@class API::V3::FileLinks::FileLinksDownloadAPI < API::OpenProjectAPIusing Storages::Peripherals::ServiceResultRefinements- helpers Storages::Peripherals::StorageUrlHelper, Storages::Peripherals::StorageErrorHelper+ helpers Storages::Peripherals::StorageErrorHelperresources :download doget dodiff --git a/modules/storages/lib/api/v3/file_links/file_links_open_api.rb b/modules/storages/lib/api/v3/file_links/file_links_open_api.rbindex 70d29ac6a5e..e721ac5d4be 100644--- a/modules/storages/lib/api/v3/file_links/file_links_open_api.rb+++ b/modules/storages/lib/api/v3/file_links/file_links_open_api.rb@@ -27,13 +27,25 @@#++class API::V3::FileLinks::FileLinksOpenAPI < API::OpenProjectAPI- helpers Storages::Peripherals::StorageUrlHelper+ using Storages::Peripherals::ServiceResultRefinementsresources :open doget do- url = storage_url_open_file(@file_link.storage, @file_link.origin_id, open_location: params[:location])- redirect url, body: "The requested resource can be viewed at #{url}"- status 303 # The follow-up request to the resource must be GET+ Storages::Peripherals::Registry+ .resolve("queries.#{@file_link.storage.short_provider_type}.open_link")+ .call(+ storage: @file_link.storage,+ user: current_user,+ file_id: @file_link.origin_id,+ open_location: ActiveModel::Type::Boolean.new.cast(params[:location])+ )+ .match(+ on_success: ->(url) do+ redirect url, body: "The requested resource can be viewed at #{url}"+ status 303+ end,+ on_failure: ->(error) { raise_error(error) }+ )endendenddiff --git a/modules/storages/lib/api/v3/storage_files/storage_files_representer.rb b/modules/storages/lib/api/v3/storage_files/storage_files_representer.rbindex b392ca9a759..3d27ffe462b 100644--- a/modules/storages/lib/api/v3/storage_files/storage_files_representer.rb+++ b/modules/storages/lib/api/v3/storage_files/storage_files_representer.rb@@ -47,7 +47,9 @@ module API::V3::StorageFilesexec_context: :decoratorproperty :parent,- getter: ->(*) { API::V3::StorageFiles::StorageFileRepresenter.new(represented.parent, @storage, current_user:) },+ getter: ->(*) do+ API::V3::StorageFiles::StorageFileRepresenter.new(represented.parent, @storage, current_user:)+ end,exec_context: :decoratorcollection :ancestors,diff --git a/modules/storages/lib/api/v3/storages/storage_representer.rb b/modules/storages/lib/api/v3/storages/storage_representer.rbindex b4f78a6815f..c9fa7ed5afe 100644--- a/modules/storages/lib/api/v3/storages/storage_representer.rb+++ b/modules/storages/lib/api/v3/storages/storage_representer.rb@@ -51,7 +51,6 @@ module API::V3::Storages# LinkedResource module defines helper methods to describe attributesinclude API::Decorators::LinkedResourceinclude API::Decorators::DateProperty- include Storages::Peripherals::StorageUrlHelpermodule ClassMethodsprivate@@ -149,7 +148,7 @@ module API::V3::Storagesendlink :open do- { href: storage_url_open(represented) }+ { href: represented.open_link }endlink :authorizationState dodiff --git a/modules/storages/lib/open_project/storages/engine.rb b/modules/storages/lib/open_project/storages/engine.rbindex ade205c4804..a6b3ca29b4c 100644--- a/modules/storages/lib/open_project/storages/engine.rb+++ b/modules/storages/lib/open_project/storages/engine.rb@@ -35,6 +35,7 @@ module OpenProject::Storagesdef self.permissions@permissions ||= Storages::GroupFolderPropertiesSyncService::PERMISSIONS_KEYSend+# engine name is used as a default prefix for module tables when generating# tables with the rails command.# It may also be used in other places, please investigate.@@ -157,10 +158,11 @@ module OpenProject::StoragesUser.current.allowed_to?(:view_file_links, project)project.project_storages.each do |project_storage|storage = project_storage.storage- href = if project_storage.project_folder_inactive?- storage.host+ href = project_storage.open_link+ icon = if storage.provider_type_nextcloud?+ 'nextcloud-circle'else- ::Storages::Peripherals::StorageUrlHelper.storage_url_open_file(storage, project_storage.project_folder_id)+ 'hosting'endmenu.push(@@ -168,8 +170,8 @@ module OpenProject::Storageshref,caption: storage.name,before: :members,- icon: "#{storage.short_provider_type}-circle",- icon_after: "external-link",+ icon:,+ icon_after: 'external-link',skip_permissions_check: true)end