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
Replace short_provider_type with implicit to_s
Marcello Rocha0aac18fce0ff
diff --git a/modules/storages/app/common/storages/peripherals/nextcloud_connection_validator.rb b/modules/storages/app/common/storages/peripherals/nextcloud_connection_validator.rbindex c275c310b73..72047520c10 100644--- a/modules/storages/app/common/storages/peripherals/nextcloud_connection_validator.rb+++ b/modules/storages/app/common/storages/peripherals/nextcloud_connection_validator.rb@@ -61,7 +61,7 @@ module Storagesdef capabilities@capabilities ||= Peripherals::Registry- .resolve("#{@storage.short_provider_type}.queries.capabilities")+ .resolve("#{@storage}.queries.capabilities").call(storage: @storage, auth_strategy: noop)enddiff --git a/modules/storages/app/common/storages/peripherals/one_drive_connection_validator.rb b/modules/storages/app/common/storages/peripherals/one_drive_connection_validator.rbindex 478ca840985..911f8280f51 100644--- a/modules/storages/app/common/storages/peripherals/one_drive_connection_validator.rb+++ b/modules/storages/app/common/storages/peripherals/one_drive_connection_validator.rb@@ -57,7 +57,7 @@ module Storagesdef query@query ||= Peripherals::Registry- .resolve("#{@storage.short_provider_type}.queries.files")+ .resolve("#{@storage}.queries.files").call(storage: @storage, auth_strategy:, folder: root_folder)end@@ -173,7 +173,7 @@ module Storagesenddef auth_strategy- Peripherals::Registry.resolve("#{@storage.short_provider_type}.authentication.userless")+ Peripherals::Registry.resolve("#{@storage}.authentication.userless").call.with_cache(false)enddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/authentication.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication.rbindex 364f5242704..28617553f9c 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/authentication.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication.rb@@ -58,7 +58,7 @@ module Storagesauth_strategy = AuthenticationStrategies::OAuthUserToken.strategy.with_user(user)Registry- .resolve("#{storage.short_provider_type}.queries.auth_check")+ .resolve("#{storage}.queries.auth_check").call(storage:, auth_strategy:).match(on_success: ->(*) { :connected },diff --git a/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.html.erb b/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.html.erbindex 0f8d107db56..500628a42f3 100644--- a/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.html.erb+++ b/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.html.erb@@ -8,7 +8,7 @@) do |form|flex_layout do |oauth_client_row|oauth_client_row.with_row(mb: 3) do- render(Primer::Beta::Text.new(font_weight: :bold)) { I18n.t("storages.file_storage_view.#{storage.short_provider_type}_oauth") }+ render(Primer::Beta::Text.new(font_weight: :bold)) { I18n.t("storages.file_storage_view.#{storage}_oauth") }endoauth_client_row.with_row(mb: 3) dodiff --git a/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.rb b/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.rbindex db9ee4cf6d3..d2fda9355e9 100644--- a/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.rb+++ b/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.rb@@ -52,8 +52,8 @@ module Storages::Admin::Formsenddef storage_provider_credentials_instructions- I18n.t("storages.instructions.#{storage.short_provider_type}.oauth_configuration",- application_link_text: send(:"#{storage.short_provider_type}_integration_link")).html_safe+ I18n.t("storages.instructions.#{storage}.oauth_configuration",+ application_link_text: send(:"#{storage}_integration_link")).html_safeendprivatediff --git a/modules/storages/app/components/storages/admin/oauth_client_info_component.html.erb b/modules/storages/app/components/storages/admin/oauth_client_info_component.html.erbindex d6c7f749341..04c67a9394b 100644--- a/modules/storages/app/components/storages/admin/oauth_client_info_component.html.erb+++ b/modules/storages/app/components/storages/admin/oauth_client_info_component.html.erb@@ -5,7 +5,7 @@concat(render(Primer::Beta::Text.new(font_weight: :bold, mr: 1, test_selector: 'storage-oauth-client-label')- ) { I18n.t("storages.file_storage_view.#{storage.short_provider_type}_oauth") }+ ) { I18n.t("storages.file_storage_view.#{storage}_oauth") })concat(configuration_check_label_for(:storage_oauth_client_configured))enddiff --git a/modules/storages/app/components/storages/admin/oauth_client_info_component.rb b/modules/storages/app/components/storages/admin/oauth_client_info_component.rbindex 71e3bbc3759..b4379d32cf8 100644--- a/modules/storages/app/components/storages/admin/oauth_client_info_component.rb+++ b/modules/storages/app/components/storages/admin/oauth_client_info_component.rb@@ -46,7 +46,7 @@ module Storages::Admindef edit_icon_button_optionslabel = I18n.t("storages.buttons.replace_oauth_client",- provider_type: I18n.t("storages.provider_types.#{storage.short_provider_type}.name"))+ provider_type: I18n.t("storages.provider_types.#{storage}.name")){icon: oauth_client_configured? ? :sync : :pencil,@@ -64,7 +64,7 @@ module Storages::Admindef edit_icon_button_data_options{}.tap do |data_h|if oauth_client_configured?- provider_type = I18n.t("storages.provider_types.#{storage.short_provider_type}.name")+ provider_type = I18n.t("storages.provider_types.#{storage}.name")data_h[:turbo_confirm] = I18n.t("storages.confirm_replace_oauth_client", provider_type:)enddata_h[:turbo_stream] = truediff --git a/modules/storages/app/components/storages/admin/storage_row_component.html.erb b/modules/storages/app/components/storages/admin/storage_row_component.html.erbindex ce9eaea2a5b..d44b4819eb2 100644--- a/modules/storages/app/components/storages/admin/storage_row_component.html.erb+++ b/modules/storages/app/components/storages/admin/storage_row_component.html.erb@@ -21,7 +21,7 @@endgrid.with_area(:provider, tag: :div, color: :subtle, mr: 3, hide: :sm, data: { 'test-selector': 'storage-provider' }) do- render(Primer::Beta::Truncate.new(font_weight: :light)) { I18n.t("storages.provider_types.#{storage.short_provider_type}.name") }+ render(Primer::Beta::Truncate.new(font_weight: :light)) { I18n.t("storages.provider_types.#{storage}.name") }endgrid.with_area(:time, tag: :div, color: :subtle) dodiff --git a/modules/storages/app/components/storages/admin/storage_view_information.rb b/modules/storages/app/components/storages/admin/storage_view_information.rbindex baf91d6b529..2607670dd99 100644--- a/modules/storages/app/components/storages/admin/storage_view_information.rb+++ b/modules/storages/app/components/storages/admin/storage_view_information.rb@@ -9,7 +9,7 @@ module Storages::Adminenddef storage_description- [I18n.t("storages.provider_types.#{storage.short_provider_type}.name"),+ [I18n.t("storages.provider_types.#{storage}.name"),storage.name,storage.host].compact.join(" - ")end@@ -62,7 +62,7 @@ module Storages::Adminif storage.oauth_client"#{I18n.t('storages.label_oauth_client_id')}: #{storage.oauth_client.client_id}"else- I18n.t("storages.configuration_checks.oauth_client_incomplete.#{storage.short_provider_type}")+ I18n.t("storages.configuration_checks.oauth_client_incomplete.#{storage}")endend@@ -70,7 +70,7 @@ module Storages::Adminif storage.oauth_client"#{I18n.t('storages.label_uri')}: #{storage.oauth_client.redirect_uri}"else- I18n.t("storages.configuration_checks.redirect_uri_incomplete.#{storage.short_provider_type}")+ I18n.t("storages.configuration_checks.redirect_uri_incomplete.#{storage}")endendenddiff --git a/modules/storages/app/components/storages/admin/storages/oauth_access_grant_nudge_modal_component.rb b/modules/storages/app/components/storages/admin/storages/oauth_access_grant_nudge_modal_component.rbindex f879ab909b1..23cc88b340d 100644--- a/modules/storages/app/components/storages/admin/storages/oauth_access_grant_nudge_modal_component.rb+++ b/modules/storages/app/components/storages/admin/storages/oauth_access_grant_nudge_modal_component.rb@@ -57,7 +57,7 @@ module Storagesdef waiting_title = I18n.t("storages.oauth_grant_nudge_modal.requesting_access_to", storage: storage.name)def cancel_button_text = I18n.t(:button_close)def body_text = I18n.t("storages.oauth_grant_nudge_modal.storage_admin.description", provider_type:)- def provider_type = I18n.t("storages.provider_types.#{storage.short_provider_type}.name")+ def provider_type = I18n.t("storages.provider_types.#{storage}.name")def login_button_aria_labelI18n.t("storages.oauth_grant_nudge_modal.login_button_aria_label", storage: storage.name)diff --git a/modules/storages/app/controllers/storages/project_storages_controller.rb b/modules/storages/app/controllers/storages/project_storages_controller.rbindex 36aab106ef6..cb3b738e4d3 100644--- a/modules/storages/app/controllers/storages/project_storages_controller.rb+++ b/modules/storages/app/controllers/storages/project_storages_controller.rb@@ -1,3 +1,5 @@+# frozen_string_literal: true+#-- copyright# OpenProject is an open source project management software.# Copyright (C) the OpenProject GmbH@@ -45,7 +47,7 @@ class Storages::ProjectStoragesController < ApplicationController# check if user "see" project_folderif @object.project_folder_id.present?::Storages::Peripherals::Registry- .resolve("#{@storage.short_provider_type}.queries.file_info")+ .resolve("#{@storage}.queries.file_info").call(storage: @storage, auth_strategy:, file_id: @object.project_folder_id).match(on_success: user_can_read_project_folder,diff --git a/modules/storages/app/forms/storages/admin/managed_project_folders/application_password_input.rb b/modules/storages/app/forms/storages/admin/managed_project_folders/application_password_input.rbindex 429342b5800..4e2609a2fc0 100644--- a/modules/storages/app/forms/storages/admin/managed_project_folders/application_password_input.rb+++ b/modules/storages/app/forms/storages/admin/managed_project_folders/application_password_input.rb@@ -1,3 +1,5 @@+# frozen_string_literal: true+#-- copyright# OpenProject is an open source project management software.# Copyright (C) the OpenProject GmbH@@ -58,7 +60,7 @@ module Storages::Admin::ManagedProjectFoldershref: Storages::UrlBuilder.url(@storage.uri, "settings/admin/openproject"),target: "_blank")- ) { I18n.t("storages.instructions.#{@storage.short_provider_type}.integration") }+ ) { I18n.t("storages.instructions.#{@storage}.integration") }endendenddiff --git a/modules/storages/app/forms/storages/admin/oauth_client_form.rb b/modules/storages/app/forms/storages/admin/oauth_client_form.rbindex 35a61299b59..58ce31a07e3 100644--- a/modules/storages/app/forms/storages/admin/oauth_client_form.rb+++ b/modules/storages/app/forms/storages/admin/oauth_client_form.rb@@ -1,3 +1,5 @@+# frozen_string_literal: true+#-- copyright# OpenProject is an open source project management software.# Copyright (C) the OpenProject GmbH@@ -69,11 +71,11 @@ module Storages::Adminenddef label_client_id- I18n.t("storages.provider_types.#{@storage.short_provider_type}.label_oauth_client_id")+ I18n.t("storages.provider_types.#{@storage}.label_oauth_client_id")enddef label_client_secret- I18n.t("storages.provider_types.#{@storage.short_provider_type}.label_oauth_client_secret")+ I18n.t("storages.provider_types.#{@storage}.label_oauth_client_secret")endendenddiff --git a/modules/storages/app/models/storages/project_storage.rb b/modules/storages/app/models/storages/project_storage.rbindex 72ff63a3f5f..5eee6413f30 100644--- a/modules/storages/app/models/storages/project_storage.rb+++ b/modules/storages/app/models/storages/project_storage.rb@@ -88,11 +88,11 @@ module Storagesif project_folder_not_accessible?(user)Peripherals::Registry- .resolve("#{storage.short_provider_type}.queries.open_storage")+ .resolve("#{storage}.queries.open_storage").call(storage:, auth_strategy:)elsePeripherals::Registry- .resolve("#{storage.short_provider_type}.queries.open_file_link")+ .resolve("#{storage}.queries.open_file_link").call(storage:, auth_strategy:, file_id: project_folder_id)endend@@ -118,7 +118,7 @@ module Storagesdef managed_folder_identifier@managed_folder_identifier ||=- Peripherals::Registry.resolve("#{storage.short_provider_type}.models.managed_folder_identifier").new(self)+ Peripherals::Registry.resolve("#{storage}.models.managed_folder_identifier").new(self)enddef project_folder_not_accessible?(user)diff --git a/modules/storages/app/services/storages/oauth_applications/create_service.rb b/modules/storages/app/services/storages/oauth_applications/create_service.rbindex 76120a879a8..e8c19d757ce 100644--- a/modules/storages/app/services/storages/oauth_applications/create_service.rb+++ b/modules/storages/app/services/storages/oauth_applications/create_service.rb@@ -1,3 +1,5 @@+# frozen_string_literal: true+#-- copyright# OpenProject is an open source project management software.# Copyright (C) the OpenProject GmbH@@ -45,7 +47,7 @@ module Storages::OAuthApplications::OAuth::Applications::CreateService.new(user:).call(- name: "#{storage.name} (#{I18n.t("storages.provider_types.#{storage.short_provider_type}.name")})",+ name: "#{storage.name} (#{I18n.t("storages.provider_types.#{storage}.name")})",redirect_uri: File.join(storage.host, "index.php/apps/integration_openproject/oauth-redirect"),scopes: "api_v3",confidential: true,diff --git a/modules/storages/app/services/storages/project_storages/copy_project_folders_service.rb b/modules/storages/app/services/storages/project_storages/copy_project_folders_service.rbindex de5059ca198..3b3e4caae62 100644--- a/modules/storages/app/services/storages/project_storages/copy_project_folders_service.rb+++ b/modules/storages/app/services/storages/project_storages/copy_project_folders_service.rb@@ -74,7 +74,7 @@ module Storagesdef initiate_copy(storage, source_path, destination_path)Peripherals::Registry- .resolve("#{storage.short_provider_type}.commands.copy_template_folder")+ .resolve("#{storage}.commands.copy_template_folder").call(auth_strategy: auth_strategy(storage.short_provider_type),storage:,source_path:,diff --git a/modules/storages/app/services/storages/storage_files_service.rb b/modules/storages/app/services/storages/storage_files_service.rbnew file mode 100644index 00000000000..c554c2b4edf--- /dev/null+++ b/modules/storages/app/services/storages/storage_files_service.rb@@ -0,0 +1,24 @@+# frozen_string_literal: true++#-- copyright+#++++module Storages+ class StorageFilesService < BaseService+ def self.call(storage:, user:, folder:)+ new.call(storage:, user:, folder:)+ end++ def call(user:, storage:, folder:)+ auth_strategy = strategy(storage, user)++ Peripherals::Registry.resolve("#{storage}.queries.files").call(storage:, auth_strategy:, folder:)+ end++ private++ def strategy(storage, user)+ Peripherals::Registry.resolve("#{storage}.authentication.user_bound").call(user:)+ end+ end+enddiff --git a/modules/storages/app/services/storages/storages/update_service.rb b/modules/storages/app/services/storages/storages/update_service.rbindex efa30027ebb..7f50b94f2dd 100644--- a/modules/storages/app/services/storages/storages/update_service.rb+++ b/modules/storages/app/services/storages/storages/update_service.rb@@ -1,3 +1,5 @@+# frozen_string_literal: true+#-- copyright# OpenProject is an open source project management software.# Copyright (C) the OpenProject GmbH@@ -32,7 +34,7 @@ module Storages::Storagesprotecteddef after_perform(service_call)- super(service_call)+ superstorage = service_call.resultif storage.provider_type_nextcloud?@@ -40,7 +42,7 @@ module Storages::Storagespersist_service_result = ::OAuth::Applications::UpdateService.new(model: application, user:).call(- name: "#{storage.name} (#{I18n.t("storages.provider_types.#{storage.short_provider_type}.name")})",+ name: "#{storage.name} (#{I18n.t("storages.provider_types.#{storage}.name")})",redirect_uri: File.join(storage.host, "index.php/apps/integration_openproject/oauth-redirect"))service_call.add_dependent!(persist_service_result)diff --git a/modules/storages/app/services/storages/upload_link_service.rb b/modules/storages/app/services/storages/upload_link_service.rbindex 95040b50f20..f7620e14c76 100644--- a/modules/storages/app/services/storages/upload_link_service.rb+++ b/modules/storages/app/services/storages/upload_link_service.rb@@ -57,7 +57,7 @@ module Storagesdef request_upload_link(auth_strategy, upload_data)Peripherals::Registry- .resolve("#{@storage.short_provider_type}.queries.upload_link")+ .resolve("#{@storage}.queries.upload_link").call(storage: @storage, auth_strategy:, upload_data:).on_failure do |error|add_error(:base, error.errors, options: { storage_name: @storage.name, folder: upload_data.folder_id })@@ -75,7 +75,7 @@ module Storagesenddef auth_strategy(user)- Peripherals::Registry.resolve("#{@storage.short_provider_type}.authentication.user_bound").call(user:)+ Peripherals::Registry.resolve("#{@storage}.authentication.user_bound").call(user:)endendenddiff --git a/modules/storages/app/views/storages/admin/storages/_new.html.erb b/modules/storages/app/views/storages/admin/storages/_new.html.erbindex 37eabdfb3c9..3c315c263f2 100644--- a/modules/storages/app/views/storages/admin/storages/_new.html.erb+++ b/modules/storages/app/views/storages/admin/storages/_new.html.erb@@ -55,7 +55,7 @@ See COPYRIGHT and LICENSE files for more details.<div class="form--field -required"><%= f.text_field :name,required: true,- placeholder: I18n.t("storages.provider_types.#{@storage.short_provider_type}.name_placeholder"),+ placeholder: I18n.t("storages.provider_types.#{@storage}.name_placeholder"),container_class: '-slim',data: {'storages--storage-form-target': 'storageName'diff --git a/modules/storages/app/views/storages/admin/storages/new.html.erb b/modules/storages/app/views/storages/admin/storages/new.html.erbindex 53997a99e87..487a108c198 100644--- a/modules/storages/app/views/storages/admin/storages/new.html.erb+++ b/modules/storages/app/views/storages/admin/storages/new.html.erb@@ -1,7 +1,7 @@<!-- Standard Ruby view, please see the controller for comments --><%label_new_file_storage = t("storages.label_new_file_storage",- provider: t("storages.provider_types.#{@storage.short_provider_type}.name"))+ provider: t("storages.provider_types.#{@storage}.name"))%><% html_title t(:label_administration), t("project_module_storages"), label_new_file_storage %>@@ -18,8 +18,8 @@<% header.with_description(test_selector: 'storage-new-page-header--description') do %><%=t("storages.instructions.new_storage",- provider_link: ::OpenProject::Static::Links[:storage_docs][:"#{@storage.short_provider_type}_setup"][:href].html_safe,- provider_name: I18n.t("storages.provider_types.#{@storage.short_provider_type}.name")+ provider_link: ::OpenProject::Static::Links[:storage_docs][:"#{@storage}_setup"][:href].html_safe,+ provider_name: I18n.t("storages.provider_types.#{@storage}.name")).html_safe%><% end %>diff --git a/modules/storages/app/views/storages/admin/storages/update.turbo_stream.erb b/modules/storages/app/views/storages/admin/storages/update.turbo_stream.erbindex e2ca4d7006e..66c5f17c4d6 100644--- a/modules/storages/app/views/storages/admin/storages/update.turbo_stream.erb+++ b/modules/storages/app/views/storages/admin/storages/update.turbo_stream.erb@@ -1,6 +1,6 @@<%label_storage_provider_part = render(Primer::Beta::Text.new(tag: :span, font_weight: :light, color: :muted)) do- "(#{I18n.t("storages.provider_types.#{@storage.short_provider_type}.name")})"+ "(#{I18n.t("storages.provider_types.#{@storage}.name")})"endlabel_storage_name_with_provider_label = "#{@storage.name} #{label_storage_provider_part}".html_safe%>diff --git a/modules/storages/app/views/storages/project_settings/_storage_select_form.html.erb b/modules/storages/app/views/storages/project_settings/_storage_select_form.html.erbindex c245e35e4be..08d265290ba 100644--- a/modules/storages/app/views/storages/project_settings/_storage_select_form.html.erb+++ b/modules/storages/app/views/storages/project_settings/_storage_select_form.html.erb@@ -29,7 +29,7 @@ See COPYRIGHT and LICENSE files for more details.<div class="form--field -required"><%= f.select :storage_id,- @available_storages.map { |storage| ["#{storage.name} (#{storage.short_provider_type})", storage.id] },+ @available_storages.map { |storage| ["#{storage.name} (#{storage})", storage.id] },class: '-bold',selected: @available_storages.first.id.to_s,container_class: '-slim'diff --git a/modules/storages/app/views/storages/storages_mailer/_health_status_notification.html.erb b/modules/storages/app/views/storages/storages_mailer/_health_status_notification.html.erbindex 1e05c21b44c..220df2dcb49 100644--- a/modules/storages/app/views/storages/storages_mailer/_health_status_notification.html.erb+++ b/modules/storages/app/views/storages/storages_mailer/_health_status_notification.html.erb@@ -47,7 +47,7 @@ See COPYRIGHT and LICENSE files for more details.<%= placeholder_cell('8px', vertical: true) %><td style="color: #878787; font-size: 12px; font-weight: 700;">- <%= I18n.t("storages.provider_types.#{storage.short_provider_type}.name") %> - <%= storage.uri %>+ <%= I18n.t("storages.provider_types.#{storage}.name") %> - <%= storage.uri %></td></tr></table>diff --git a/modules/storages/app/views/storages/storages_mailer/notify_healthy.text.erb b/modules/storages/app/views/storages/storages_mailer/notify_healthy.text.erbindex 488f0c42d53..7aa05229ab5 100644--- a/modules/storages/app/views/storages/storages_mailer/notify_healthy.text.erb+++ b/modules/storages/app/views/storages/storages_mailer/notify_healthy.text.erb@@ -31,7 +31,7 @@ See COPYRIGHT and LICENSE files for more details.<%= I18n.t('mail.storages.health.plaintext.healthy.summary', storage_name: @storage.name) %>-<%= I18n.t('mail.storages.health.plaintext.storage') %>: <%= I18n.t("storages.provider_types.#{@storage.short_provider_type}.name") %> - <%= @storage.host %>+<%= I18n.t('mail.storages.health.plaintext.storage') %>: <%= I18n.t("storages.provider_types.#{@storage}.name") %> - <%= @storage.host %><%= I18n.t('mail.storages.health.plaintext.unhealthy.error-details') %>:<%= "-" * 30 %>diff --git a/modules/storages/app/views/storages/storages_mailer/notify_unhealthy.text.erb b/modules/storages/app/views/storages/storages_mailer/notify_unhealthy.text.erbindex 57c232ae536..ae03895cc21 100644--- a/modules/storages/app/views/storages/storages_mailer/notify_unhealthy.text.erb+++ b/modules/storages/app/views/storages/storages_mailer/notify_unhealthy.text.erb@@ -31,7 +31,7 @@ See COPYRIGHT and LICENSE files for more details.<%= I18n.t('mail.storages.health.plaintext.unhealthy.summary', storage_name: @storage.name) %>-<%= I18n.t('mail.storages.health.plaintext.storage') %>: <%= I18n.t("storages.provider_types.#{@storage.short_provider_type}.name") %> - <%= @storage.host %>+<%= I18n.t('mail.storages.health.plaintext.storage') %>: <%= I18n.t("storages.provider_types.#{@storage}.name") %> - <%= @storage.host %><%= I18n.t('mail.storages.health.plaintext.unhealthy.error-details') %>:<%= "-" * 30 %>diff --git a/modules/storages/app/workers/storages/automatically_managed_storage_sync_job.rb b/modules/storages/app/workers/storages/automatically_managed_storage_sync_job.rbindex ecd7544675c..801518c2c15 100644--- a/modules/storages/app/workers/storages/automatically_managed_storage_sync_job.rb+++ b/modules/storages/app/workers/storages/automatically_managed_storage_sync_job.rb@@ -52,7 +52,7 @@ module Storagesendend- def self.key(storage) = "sync-#{storage.short_provider_type}-#{storage.id}"+ def self.key(storage) = "sync-#{storage}-#{storage.id}"def perform(storage)return unless storage.configured? && storage.automatically_managed?diff --git a/modules/storages/lib/api/v3/storage_files/storage_files_api.rb b/modules/storages/lib/api/v3/storage_files/storage_files_api.rbindex a687ab8e5d8..e1102ec15b7 100644--- a/modules/storages/lib/api/v3/storage_files/storage_files_api.rb+++ b/modules/storages/lib/api/v3/storage_files/storage_files_api.rb@@ -52,23 +52,19 @@ module API::V3::StorageFilesdef fetch_upload_linklambda do |upload_data|- Rails.logger.error "UploadLink #{upload_data.inspect}"Storages::UploadLinkService.call(storage: @storage, upload_data:, user: current_user)endenddef auth_strategy- Storages::Peripherals::Registry- .resolve("#{@storage.short_provider_type}.authentication.user_bound")- .call(user: current_user)+ Storages::Peripherals::Registry.resolve("#{@storage}.authentication.user_bound").call(user: current_user)endendresources :files doget do- Storages::Peripherals::Registry- .resolve("#{@storage.short_provider_type}.queries.files")- .call(storage: @storage, auth_strategy:, folder: extract_parent_folder(params))+ Storages::StorageFilesService+ .call(storage: @storage, user: current_user, folder: extract_parent_folder(params)).match(on_success: ->(files) { API::V3::StorageFiles::StorageFilesRepresenter.new(files, @storage, current_user:) },on_failure: ->(error) { raise_error(error) }@@ -78,7 +74,7 @@ module API::V3::StorageFilesroute_param :file_id, type: String, desc: "Storage file id" doget doStorages::Peripherals::Registry- .resolve("#{@storage.short_provider_type}.queries.file_info")+ .resolve("#{@storage}.queries.file_info").call(storage: @storage, auth_strategy:, file_id: params[:file_id]).map { |file_info| to_storage_file(file_info) }.match(diff --git a/modules/storages/lib/api/v3/storages/storage_open_api.rb b/modules/storages/lib/api/v3/storages/storage_open_api.rbindex 752f3fadc6b..937c33ba601 100644--- a/modules/storages/lib/api/v3/storages/storage_open_api.rb+++ b/modules/storages/lib/api/v3/storages/storage_open_api.rb@@ -1,3 +1,5 @@+# frozen_string_literal: true+#-- copyright# OpenProject is an open source project management software.# Copyright (C) the OpenProject GmbH@@ -38,7 +40,7 @@ class API::V3::Storages::StorageOpenAPI < API::OpenProjectAPI.with_user(current_user)Storages::Peripherals::Registry- .resolve("#{@storage.short_provider_type}.queries.open_storage")+ .resolve("#{@storage}.queries.open_storage").call(storage: @storage, auth_strategy:).match(on_success: ->(url) dodiff --git a/modules/storages/spec/common/storages/peripherals/nextcloud_connection_validator_spec.rb b/modules/storages/spec/common/storages/peripherals/nextcloud_connection_validator_spec.rbindex f9ddf0a3b40..b34027fbb67 100644--- a/modules/storages/spec/common/storages/peripherals/nextcloud_connection_validator_spec.rb+++ b/modules/storages/spec/common/storages/peripherals/nextcloud_connection_validator_spec.rb@@ -1,3 +1,5 @@+# frozen_string_literal: true+#-- copyright# OpenProject is an open source project management software.# Copyright (C) the OpenProject GmbH@@ -31,7 +33,7 @@ require_module_spec_helperRSpec.describe Storages::Peripherals::NextcloudConnectionValidator dobefore do- Storages::Peripherals::Registry.stub("#{storage.short_provider_type}.queries.capabilities", ->(_) { capabilities_response })+ Storages::Peripherals::Registry.stub("#{storage}.queries.capabilities", ->(_) { capabilities_response })Storages::Peripherals::Registry.stub("#{storage.short_provider_type}.queries.files", ->(_) { files_response })enddiff --git a/modules/storages/spec/common/storages/peripherals/one_drive_connection_validator_spec.rb b/modules/storages/spec/common/storages/peripherals/one_drive_connection_validator_spec.rbindex 07a1ee456f8..26bdc47292b 100644--- a/modules/storages/spec/common/storages/peripherals/one_drive_connection_validator_spec.rb+++ b/modules/storages/spec/common/storages/peripherals/one_drive_connection_validator_spec.rb@@ -1,3 +1,5 @@+# frozen_string_literal: true+#-- copyright# OpenProject is an open source project management software.# Copyright (C) the OpenProject GmbH@@ -33,7 +35,7 @@ RSpec.describe Storages::Peripherals::OneDriveConnectionValidator dolet(:storage) { create(:one_drive_storage, oauth_client: create(:oauth_client)) }before do- Storages::Peripherals::Registry.stub("#{storage.short_provider_type}.queries.files", ->(_) { response })+ Storages::Peripherals::Registry.stub("#{storage}.queries.files", ->(_) { response })endsubject { described_class.new(storage:).validate }diff --git a/modules/storages/spec/features/create_file_links_spec.rb b/modules/storages/spec/features/create_file_links_spec.rbindex d6feb7a9f8a..5dac613cef5 100644--- a/modules/storages/spec/features/create_file_links_spec.rb+++ b/modules/storages/spec/features/create_file_links_spec.rb@@ -63,7 +63,7 @@ RSpec.describe "Managing file links in work package", :js, :webmock doallow(Storages::FileLinkSyncService).to receive(:new).and_return(sync_service)Storages::Peripherals::Registry.stub(- "#{storage.short_provider_type}.queries.auth_check",+ "#{storage}.queries.auth_check",->(_) { ServiceResult.success })diff --git a/modules/storages/spec/features/manage_project_storage_spec.rb b/modules/storages/spec/features/manage_project_storage_spec.rbindex a13d14e3112..2acbb325d66 100644--- a/modules/storages/spec/features/manage_project_storage_spec.rb+++ b/modules/storages/spec/features/manage_project_storage_spec.rb@@ -97,7 +97,7 @@ RSpec.describe("Activation of storages in projects",expect(page).to have_current_path new_project_settings_project_storage_path(project_id: project)expect(page).to have_text("Add a file storage")expect(page).to have_select("storages_project_storage_storage_id",- options: ["#{storage.name} (#{storage.short_provider_type})"])+ options: ["#{storage.name} (#{storage})"])page.click_on("Continue")# by default automatic have to be choosen if storage has automatic management enableddiff --git a/modules/storages/spec/features/show_file_links_spec.rb b/modules/storages/spec/features/show_file_links_spec.rbindex e6c4445003c..74562ff1520 100644--- a/modules/storages/spec/features/show_file_links_spec.rb+++ b/modules/storages/spec/features/show_file_links_spec.rb@@ -49,7 +49,7 @@ RSpec.describe "Showing of file links in work package", :js dobefore doStorages::Peripherals::Registry.stub(- "#{storage.short_provider_type}.queries.auth_check",+ "#{storage}.queries.auth_check",->(_) { authorization_state })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.rbindex dcafe17a51c..ffc4b5ab7be 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@@ -41,7 +41,7 @@ RSpec.describe API::V3::Storages::StorageRepresenter, "rendering" dobefore doStorages::Peripherals::Registry.stub(- "#{storage.short_provider_type}.queries.auth_check",+ "#{storage}.queries.auth_check",->(_) { auth_check_result })enddiff --git a/modules/storages/spec/services/storages/oauth_applications/create_service_spec.rb b/modules/storages/spec/services/storages/oauth_applications/create_service_spec.rbindex c8aa5522765..41b0b9ddae1 100644--- a/modules/storages/spec/services/storages/oauth_applications/create_service_spec.rb+++ b/modules/storages/spec/services/storages/oauth_applications/create_service_spec.rb@@ -46,7 +46,7 @@ RSpec.describe Storages::OAuthApplications::CreateService, type: :model doexpect(subject).to be_successexpect(subject.result).to be_a Doorkeeper::Applicationexpect(subject.result.name).to include storage.name- expect(subject.result.name).to include I18n.t("storages.provider_types.#{storage.short_provider_type}.name")+ expect(subject.result.name).to include I18n.t("storages.provider_types.#{storage}.name")expect(subject.result.scopes.to_s).to eql "api_v3"expect(subject.result.redirect_uri).to include storage.hostexpect(subject.result.redirect_uri).to include "apps/integration_openproject/oauth-redirect"diff --git a/modules/storages/spec/services/storages/project_storages/delete_service_spec.rb b/modules/storages/spec/services/storages/project_storages/delete_service_spec.rbindex 10f3980ee4f..478abae6cdc 100644--- a/modules/storages/spec/services/storages/project_storages/delete_service_spec.rb+++ b/modules/storages/spec/services/storages/project_storages/delete_service_spec.rb@@ -39,7 +39,7 @@ RSpec.describe Storages::ProjectStorages::DeleteService, :webmock, type: :modelbefore doStorages::Peripherals::Registry- .stub("#{storage.short_provider_type}.commands.delete_folder", command_double)+ .stub("#{storage}.commands.delete_folder", command_double)endcontext "if project folder mode is set to automatic" dodiff --git a/modules/storages/spec/support/shared_examples_for_adapters/create_folder_command_examples.rb b/modules/storages/spec/support/shared_examples_for_adapters/create_folder_command_examples.rbindex 86ba8fe62a9..7c68f2cc762 100644--- a/modules/storages/spec/support/shared_examples_for_adapters/create_folder_command_examples.rb+++ b/modules/storages/spec/support/shared_examples_for_adapters/create_folder_command_examples.rb@@ -31,7 +31,7 @@RSpec.shared_examples_for "create_folder_command: basic command setup" doit "is registered as commands.create_folder" doexpect(Storages::Peripherals::Registry- .resolve("#{storage.short_provider_type}.commands.create_folder")).to eq(described_class)+ .resolve("#{storage}.commands.create_folder")).to eq(described_class)endit "responds to #call with correct parameters" dodiff --git a/modules/storages/spec/support/shared_examples_for_adapters/file_info_query_examples.rb b/modules/storages/spec/support/shared_examples_for_adapters/file_info_query_examples.rbindex e0777b05909..df8cbe493e4 100644--- a/modules/storages/spec/support/shared_examples_for_adapters/file_info_query_examples.rb+++ b/modules/storages/spec/support/shared_examples_for_adapters/file_info_query_examples.rb@@ -31,7 +31,7 @@RSpec.shared_examples_for "file_info_query: basic query setup" doit "is registered as queries.file_info" doexpect(Storages::Peripherals::Registry- .resolve("#{storage.short_provider_type}.queries.file_info")).to eq(described_class)+ .resolve("#{storage}.queries.file_info")).to eq(described_class)endit "responds to #call with correct parameters" dodiff --git a/modules/storages/spec/support/shared_examples_for_adapters/file_path_to_id_map_query_examples.rb b/modules/storages/spec/support/shared_examples_for_adapters/file_path_to_id_map_query_examples.rbindex 6abec5e1921..6d84b31c2a7 100644--- a/modules/storages/spec/support/shared_examples_for_adapters/file_path_to_id_map_query_examples.rb+++ b/modules/storages/spec/support/shared_examples_for_adapters/file_path_to_id_map_query_examples.rb@@ -31,7 +31,7 @@RSpec.shared_examples_for "file_path_to_id_map_query: basic query setup" doit "is registered as queries.file_path_to_id_map" doexpect(Storages::Peripherals::Registry- .resolve("#{storage.short_provider_type}.queries.file_path_to_id_map")).to eq(described_class)+ .resolve("#{storage}.queries.file_path_to_id_map")).to eq(described_class)endit "responds to #call with correct parameters" dodiff --git a/modules/storages/spec/support/shared_examples_for_adapters/files_query_examples.rb b/modules/storages/spec/support/shared_examples_for_adapters/files_query_examples.rbindex 7e68098f9c5..17a15629427 100644--- a/modules/storages/spec/support/shared_examples_for_adapters/files_query_examples.rb+++ b/modules/storages/spec/support/shared_examples_for_adapters/files_query_examples.rb@@ -31,7 +31,7 @@RSpec.shared_examples_for "files_query: basic query setup" doit "is registered as queries.files" doexpect(Storages::Peripherals::Registry- .resolve("#{storage.short_provider_type}.queries.files")).to eq(described_class)+ .resolve("#{storage}.queries.files")).to eq(described_class)endit "responds to #call with correct parameters" dodiff --git a/modules/storages/spec/support/shared_examples_for_adapters/rename_file_command_examples.rb b/modules/storages/spec/support/shared_examples_for_adapters/rename_file_command_examples.rbindex 3fc9d4e55a7..1f71426f20c 100644--- a/modules/storages/spec/support/shared_examples_for_adapters/rename_file_command_examples.rb+++ b/modules/storages/spec/support/shared_examples_for_adapters/rename_file_command_examples.rb@@ -31,7 +31,7 @@RSpec.shared_examples_for "rename_file_command: basic command setup" doit "is registered as commands.rename_file" doexpect(Storages::Peripherals::Registry- .resolve("#{storage.short_provider_type}.commands.rename_file")).to eq(described_class)+ .resolve("#{storage}.commands.rename_file")).to eq(described_class)endit "responds to #call with correct parameters" dodiff --git a/modules/storages/spec/support/shared_examples_for_adapters/set_permissions_command_examples.rb b/modules/storages/spec/support/shared_examples_for_adapters/set_permissions_command_examples.rbindex d6e7926d906..2e423ea664e 100644--- a/modules/storages/spec/support/shared_examples_for_adapters/set_permissions_command_examples.rb+++ b/modules/storages/spec/support/shared_examples_for_adapters/set_permissions_command_examples.rb@@ -31,7 +31,7 @@RSpec.shared_examples_for "set_permissions_command: basic command setup" doit "is registered as commands.set_permissions" doexpect(Storages::Peripherals::Registry- .resolve("#{storage.short_provider_type}.commands.set_permissions")).to eq(described_class)+ .resolve("#{storage}.commands.set_permissions")).to eq(described_class)endit "responds to #call with correct parameters" dodiff --git a/modules/storages/spec/support/shared_examples_for_adapters/upload_link_query_examples.rb b/modules/storages/spec/support/shared_examples_for_adapters/upload_link_query_examples.rbindex 6c527700ff9..5b890666812 100644--- a/modules/storages/spec/support/shared_examples_for_adapters/upload_link_query_examples.rb+++ b/modules/storages/spec/support/shared_examples_for_adapters/upload_link_query_examples.rb@@ -31,7 +31,7 @@RSpec.shared_examples_for "upload_link_query: basic query setup" doit "is registered as queries.upload_link" doexpect(Storages::Peripherals::Registry- .resolve("#{storage.short_provider_type}.queries.upload_link")).to eq(described_class)+ .resolve("#{storage}.queries.upload_link")).to eq(described_class)endit "responds to #call with correct parameters" dodiff --git a/modules/storages/spec/workers/storages/copy_project_folders_job_spec.rb b/modules/storages/spec/workers/storages/copy_project_folders_job_spec.rbindex 33b45c4ff14..73684682c11 100644--- a/modules/storages/spec/workers/storages/copy_project_folders_job_spec.rb+++ b/modules/storages/spec/workers/storages/copy_project_folders_job_spec.rb@@ -123,17 +123,17 @@ RSpec.describe Storages::CopyProjectFoldersJob, :job, :webmock, with_good_job_badescribe "managed project folders" dobefore doStorages::Peripherals::Registry- .stub("#{storage.short_provider_type}.queries.file_path_to_id_map", lambda { |storage:, auth_strategy:, folder:|+ .stub("#{storage}.queries.file_path_to_id_map", lambda { |storage:, auth_strategy:, folder:|ServiceResult.success(result: target_deep_file_ids)})Storages::Peripherals::Registry- .stub("#{storage.short_provider_type}.queries.files_info", lambda { |storage:, auth_strategy:, file_ids:|+ .stub("#{storage}.queries.files_info", lambda { |storage:, auth_strategy:, file_ids:|ServiceResult.success(result: source_file_infos)})Storages::Peripherals::Registry- .stub("#{storage.short_provider_type}.commands.copy_template_folder",+ .stub("#{storage}.commands.copy_template_folder",lambda { |auth_strategy:, storage:, source_path:, destination_path:|ServiceResult.success(result: copy_result.with(id: "copied-folder", polling_url:))})@@ -172,18 +172,18 @@ RSpec.describe Storages::CopyProjectFoldersJob, :job, :webmock, with_good_job_babefore doStorages::Peripherals::Registry- .stub("#{storage.short_provider_type}.commands.copy_template_folder",+ .stub("#{storage}.commands.copy_template_folder",lambda { |auth_strategy:, storage:, source_path:, destination_path:|ServiceResult.success(result: copy_result.with(polling_url:, requires_polling: true))})Storages::Peripherals::Registry- .stub("#{storage.short_provider_type}.queries.file_path_to_id_map", lambda { |storage:, auth_strategy:, folder:|+ .stub("#{storage}.queries.file_path_to_id_map", lambda { |storage:, auth_strategy:, folder:|ServiceResult.success(result: target_deep_file_ids)})Storages::Peripherals::Registry- .stub("#{storage.short_provider_type}.queries.files_info", lambda { |storage:, auth_strategy:, file_ids:|+ .stub("#{storage}.queries.files_info", lambda { |storage:, auth_strategy:, file_ids:|ServiceResult.success(result: source_file_infos)})@@ -238,7 +238,7 @@ RSpec.describe Storages::CopyProjectFoldersJob, :job, :webmock, with_good_job_bacontext "when an error occurs" dobefore doStorages::Peripherals::Registry- .stub("#{storage.short_provider_type}.commands.copy_template_folder",+ .stub("#{storage}.commands.copy_template_folder",lambda { |auth_strategy:, storage:, source_path:, destination_path:|ServiceResult.failure(result: :error,diff --git a/spec/requests/oauth_clients/ensure_connection_flow_spec.rb b/spec/requests/oauth_clients/ensure_connection_flow_spec.rbindex 7cd2f3d80c9..b7ac2e2943e 100644--- a/spec/requests/oauth_clients/ensure_connection_flow_spec.rb+++ b/spec/requests/oauth_clients/ensure_connection_flow_spec.rb@@ -1,3 +1,5 @@+# frozen_string_literal: true+#-- copyright# OpenProject is an open source project management software.# Copyright (C) the OpenProject GmbH@@ -36,7 +38,7 @@ RSpec.describe "/oauth_clients/:oauth_client_id/ensure_connection endpoint", :webefore doStorages::Peripherals::Registry.stub(- "#{storage.short_provider_type}.queries.auth_check",+ "#{storage}.queries.auth_check",->(_) { ServiceResult.success })end@@ -64,7 +66,7 @@ RSpec.describe "/oauth_clients/:oauth_client_id/ensure_connection endpoint", :webefore doStorages::Peripherals::Registry.stub(- "#{storage.short_provider_type}.queries.auth_check",+ "#{storage}.queries.auth_check",->(_) { ServiceResult.failure(errors: Storages::StorageError.new(code: :unauthorized)) })