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
Removed unnecessary type check in StorageAuthorizer
Andreas Pfohl57bfd16eb815
diff --git a/modules/storages/lib/api/v3/storages/storage_authorizer.rb b/modules/storages/lib/api/v3/storages/storage_authorizer.rbindex 3c4c82d52c6..6d0a59c0d14 100644--- a/modules/storages/lib/api/v3/storages/storage_authorizer.rb+++ b/modules/storages/lib/api/v3/storages/storage_authorizer.rb@@ -38,26 +38,18 @@ module APIURN_CONNECTION_ERROR = "#{::API::V3::URN_PREFIX}storages:authorization:Error".freezeclass StorageAuthorizer- def authorize(storage)- throw TypeError unless storage.is_a? Storage.class-- oauth_client = storage.oauth_client- connection_manager = ::OAuthClients::ConnectionManager.new(user: User.current, oauth_client:)- state = connection_manager.authorization_state-- to_urn(state)- end-- private-- def to_urn(state)- case state- when :connected- URN_CONNECTION_CONNECTED- when :failed_authorization- URN_CONNECTION_AUTH_FAILED- else- URN_CONNECTION_ERROR+ class << self+ def authorize(storage)+ oauth_client = storage.oauth_client+ connection_manager = ::OAuthClients::ConnectionManager.new(user: User.current, oauth_client:)+ case connection_manager.authorization_state+ when :connected+ URN_CONNECTION_CONNECTED+ when :failed_authorization+ URN_CONNECTION_AUTH_FAILED+ else+ URN_CONNECTION_ERROR+ endendendenddiff --git a/modules/storages/lib/api/v3/storages/storage_representer.rb b/modules/storages/lib/api/v3/storages/storage_representer.rbindex bb847204452..269140263af 100644--- a/modules/storages/lib/api/v3/storages/storage_representer.rb+++ b/modules/storages/lib/api/v3/storages/storage_representer.rb@@ -60,7 +60,7 @@ module APIendlink :authorizationState do- state = StorageAuthorizer.authorize represented+ state = ::API::V3::Storages::StorageAuthorizer.authorize representedtitle = I18n.t(:"oauth_client.urn_connection_status.#{state.split(':').last}"){ href: state, title: }