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
[#44841] fixed merge conflict problems
Eric Schubert46d394501f70
diff --git a/docs/api/apiv3/components/schemas/oauth_application_read_model.yml b/docs/api/apiv3/components/schemas/oauth_application_read_model.ymlindex e3fe8766c6c..3c01527ebe9 100644--- a/docs/api/apiv3/components/schemas/oauth_application_read_model.yml+++ b/docs/api/apiv3/components/schemas/oauth_application_read_model.yml@@ -84,8 +84,8 @@ example:name: Vader's secure OAuth appclientId: O5h6WObhMg1Z8IcLHRE3_LMh4jJYmmca2V6OTFSv8DAconfidential: true- createdAt: 2022-12-07T12:56:42Z- updatedAt: 2022-12-07T12:56:42Z+ createdAt: '2022-12-07T12:56:42Z'+ updatedAt: '2022-12-07T12:56:42Z'scopes:- api_v3_links:diff --git a/docs/api/apiv3/components/schemas/oauth_client_credentials_read_model.yml b/docs/api/apiv3/components/schemas/oauth_client_credentials_read_model.ymlindex deff6f9a183..ef72b458d81 100644--- a/docs/api/apiv3/components/schemas/oauth_client_credentials_read_model.yml+++ b/docs/api/apiv3/components/schemas/oauth_client_credentials_read_model.yml@@ -56,8 +56,8 @@ example:_type: OAuthClientCredentialsclientId: O5h6WObhMg1Z8IcLHRE3_LMh4jJYmmca2V6OTFSv8DAconfidential: true- createdAt: 2022-12-07T12:56:42Z- updatedAt: 2022-12-07T12:56:42Z+ createdAt: '2022-12-07T12:56:42Z'+ updatedAt: '2022-12-07T12:56:42Z'_link:self:href: '/api/v3/oauth_client_credentials/1337'diff --git a/docs/api/apiv3/openapi-spec.yml b/docs/api/apiv3/openapi-spec.ymlindex c6ddf2cbbc2..1f5baf61fa5 100644--- a/docs/api/apiv3/openapi-spec.yml+++ b/docs/api/apiv3/openapi-spec.yml@@ -660,6 +660,8 @@ components:"$ref": "./components/schemas/notification_settings_model.yml"Offset_based_pagination:"$ref": "./components/schemas/offset_based_pagination.yml"+ OAuthApplicationReadModel:+ "$ref": "./components/schemas/oauth_application_read_model.yml"OAuthClientCredentialsReadModel:"$ref": "./components/schemas/oauth_client_credentials_read_model.yml"OAuthClientCredentialsWriteModel:diff --git a/modules/storages/lib/api/v3/storages/storages_api.rb b/modules/storages/lib/api/v3/storages/storages_api.rbindex b82bdcf5b09..53926e50f96 100644--- a/modules/storages/lib/api/v3/storages/storages_api.rb+++ b/modules/storages/lib/api/v3/storages/storages_api.rb@@ -32,7 +32,7 @@# Hence, the modules of the class have to be represented in the directory structure.# OpenProjectAPI is a simple subclass of Grape::API that handles patches.-class API::V3::Storages::StoragesAPI < ::API::OpenProjectAPI+class API::V3::Storages::StoragesAPI < API::OpenProjectAPI# helpers is defined by the grape framework. They make methods from the# module available from within the endpoint context.helpers Storages::Peripherals::Scopes@@ -40,7 +40,7 @@ class API::V3::Storages::StoragesAPI < ::API::OpenProjectAPI# The `:resources` keyword defines the API namespace -> /api/v3/storages/...resources :storages do# post &::API::V3::Storages::CreateEndpoint.new(model: ::Storages::Storage).mount- post &::API::V3::Utilities::Endpoints::Create.new(model: ::Storages::Storage).mount+ post &API::V3::Utilities::Endpoints::Create.new(model: Storages::Storage).mount# `route_param` extends the route by a route parameter of the endpoint.# The input parameter value is parsed into the `:storage_id` symbol.@@ -59,11 +59,11 @@ class API::V3::Storages::StoragesAPI < ::API::OpenProjectAPI# passed as a block to the `get` helper thanks to the `&` operator.# The block will get called everytime a GET request is sent to this# route.- get &::API::V3::Utilities::Endpoints::Show.new(model: ::Storages::Storage).mount+ get &API::V3::Utilities::Endpoints::Show.new(model: Storages::Storage).mount- patch &::API::V3::Utilities::Endpoints::Update.new(model: ::Storages::Storage).mount+ patch &API::V3::Utilities::Endpoints::Update.new(model: Storages::Storage).mount- delete &::API::V3::Utilities::Endpoints::Delete.new(model: ::Storages::Storage).mount+ delete &API::V3::Utilities::Endpoints::Delete.new(model: Storages::Storage).mountmount API::V3::StorageFiles::StorageFilesAPImount API::V3::OAuthClient::OAuthClientCredentialsAPIdiff --git a/modules/storages/spec/contracts/storages/storages/shared_contract_examples.rb b/modules/storages/spec/contracts/storages/storages/shared_contract_examples.rbindex 8f10857b0bb..8fad139487f 100644--- a/modules/storages/spec/contracts/storages/storages/shared_contract_examples.rb+++ b/modules/storages/spec/contracts/storages/storages/shared_contract_examples.rb@@ -33,7 +33,7 @@ shared_examples_for 'storage contract', :storage_server_helpers, webmock: true d# Only admins have the right to create/delete storages.let(:current_user) { create(:admin) }let(:storage_name) { 'Storage 1' }- let(:storage_provider_type) { ::Storages::Storage::PROVIDER_TYPE_NEXTCLOUD }+ let(:storage_provider_type) { Storages::Storage::PROVIDER_TYPE_NEXTCLOUD }let(:storage_host) { 'https://host1.example.com' }let(:storage_creator) { current_user }diff --git a/modules/storages/spec/controller/storages_controller_spec.rb b/modules/storages/spec/controller/storages_controller_spec.rbindex f0feefbbbb4..30e9634c5b7 100644--- a/modules/storages/spec/controller/storages_controller_spec.rb+++ b/modules/storages/spec/controller/storages_controller_spec.rb@@ -30,7 +30,7 @@ require_relative '../spec_helper'# These specs mainly check that error messages from a sub-service# (about unsafe hosts with HTTP protocol) are passed to the main form.-describe ::Storages::Admin::StoragesController, type: :controller, webmock: true do+describe Storages::Admin::StoragesController, type: :controller, webmock: true dorender_views # rendering views is stubbed by default in controller specsinclude StorageServerHelpersdiff --git a/modules/storages/spec/features/create_file_links_spec.rb b/modules/storages/spec/features/create_file_links_spec.rbindex 8197e7b5a33..d50e6e06c32 100644--- a/modules/storages/spec/features/create_file_links_spec.rb+++ b/modules/storages/spec/features/create_file_links_spec.rb@@ -42,7 +42,7 @@ describe 'Creating file links in work package', js: true, webmock: true, with_fllet(:file_link) { create(:file_link, container: work_package, storage:, origin_id: '22', origin_name: 'jingle.ogg') }let(:connection_manager) do- connection_manager = instance_double(::OAuthClients::ConnectionManager)+ connection_manager = instance_double(OAuthClients::ConnectionManager)allow(connection_manager).to receive(:refresh_token).and_return(ServiceResult.success(result: oauth_client_token))allow(connection_manager).to receive(:get_access_token).and_return(ServiceResult.success(result: oauth_client_token))allow(connection_manager).to receive(:authorization_state).and_return(:connected)@@ -54,19 +54,19 @@ describe 'Creating file links in work package', js: true, webmock: true, with_fllet(:folder1_xml_response) { create(:webdav_data_folder) }let(:sync_service) do- sync_service = instance_double(::Storages::FileLinkSyncService)+ sync_service = instance_double(Storages::FileLinkSyncService)allow(sync_service).to receive(:call) do |file_links|ServiceResult.success(result: file_links.each { |file_link| file_link.origin_permission = :view })endsync_serviceend- let(:wp_page) { ::Pages::FullWorkPackage.new(work_package, project) }- let(:dialog) { ::Components::FilePickerDialog.new }+ let(:wp_page) { Pages::FullWorkPackage.new(work_package, project) }+ let(:dialog) { Components::FilePickerDialog.new }before do- allow(::OAuthClients::ConnectionManager).to receive(:new).and_return(connection_manager)- allow(::Storages::FileLinkSyncService).to receive(:new).and_return(sync_service)+ allow(OAuthClients::ConnectionManager).to receive(:new).and_return(connection_manager)+ allow(Storages::FileLinkSyncService).to receive(:new).and_return(sync_service)stub_request(:propfind, "#{storage.host}/remote.php/dav/files/#{oauth_client_token.origin_user_id}").to_return(status: 207, body: root_xml_response, headers: {})diff --git a/modules/storages/spec/features/show_file_links_spec.rb b/modules/storages/spec/features/show_file_links_spec.rbindex 7763efed7ca..2b466418a19 100644--- a/modules/storages/spec/features/show_file_links_spec.rb+++ b/modules/storages/spec/features/show_file_links_spec.rb@@ -40,13 +40,13 @@ describe 'Showing of file links in work package', js: true dolet(:oauth_client_token) { create(:oauth_client_token, oauth_client:, user: current_user) }let(:project_storage) { create(:project_storage, project:, storage:) }let(:file_link) { create(:file_link, container: work_package, storage:) }- let(:wp_page) { ::Pages::FullWorkPackage.new(work_package, project) }+ let(:wp_page) { Pages::FullWorkPackage.new(work_package, project) }- let(:connection_manager) { instance_double(::OAuthClients::ConnectionManager) }- let(:sync_service) { instance_double(::Storages::FileLinkSyncService) }+ let(:connection_manager) { instance_double(OAuthClients::ConnectionManager) }+ let(:sync_service) { instance_double(Storages::FileLinkSyncService) }before do- allow(::OAuthClients::ConnectionManager)+ allow(OAuthClients::ConnectionManager).to receive(:new).and_return(connection_manager)allow(connection_manager)@@ -60,7 +60,7 @@ describe 'Showing of file links in work package', js: true do.and_return(:connected)# Mock FileLinkSyncService as if Nextcloud would respond with origin_permission=nil- allow(::Storages::FileLinkSyncService)+ allow(Storages::FileLinkSyncService).to receive(:new).and_return(sync_service)allow(sync_service).to receive(:call) do |file_links|ServiceResult.success(result: file_links.each { |file_link| file_link.origin_permission = :view })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 58ab91e2211..5a7a341d494 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@@ -28,18 +28,18 @@require 'spec_helper'-describe ::API::V3::Storages::StorageRepresenter, 'rendering' do+describe API::V3::Storages::StorageRepresenter, 'rendering' dolet(:oauth_application) { build_stubbed(:oauth_application) }let(:oauth_client_credentials) { build_stubbed(:oauth_client) }let(:storage) { build_stubbed(:storage, oauth_application:, oauth_client: oauth_client_credentials) }let(:user) { build_stubbed(:user) }let(:representer) { described_class.new(storage, current_user: user, embed_links: true) }- let(:connection_manager) { instance_double(::OAuthClients::ConnectionManager) }+ let(:connection_manager) { instance_double(OAuthClients::ConnectionManager) }subject(:generated) { representer.to_json }before do- allow(::OAuthClients::ConnectionManager)+ allow(OAuthClients::ConnectionManager).to receive(:new).and_return(connection_manager)allow(connection_manager).to receive(:authorization_state).and_return(:connected)diff --git a/modules/storages/spec/requests/api/v3/file_links/file_links_spec.rb b/modules/storages/spec/requests/api/v3/file_links/file_links_spec.rbindex 1236ddbbc77..0182bb5d4a8 100644--- a/modules/storages/spec/requests/api/v3/file_links/file_links_spec.rb+++ b/modules/storages/spec/requests/api/v3/file_links/file_links_spec.rb@@ -64,14 +64,14 @@ describe 'API v3 file links resource' docreate(:file_link, creator: current_user, container: work_package, storage: another_storage)end- let(:connection_manager) { instance_double(::OAuthClients::ConnectionManager) }- let(:sync_service) { instance_double(::Storages::FileLinkSyncService) }+ let(:connection_manager) { instance_double(OAuthClients::ConnectionManager) }+ let(:sync_service) { instance_double(Storages::FileLinkSyncService) }subject(:response) { last_response }before do# Mock ConnectionManager to behave as if connected- allow(::OAuthClients::ConnectionManager)+ allow(OAuthClients::ConnectionManager).to receive(:new).and_return(connection_manager)allow(connection_manager).to receive(:get_access_token)@@ -82,7 +82,7 @@ describe 'API v3 file links resource' do.to receive(:get_authorization_uri).and_return('https://example.com/authorize')# Mock FileLinkSyncService as if Nextcloud would respond positively- allow(::Storages::FileLinkSyncService)+ allow(Storages::FileLinkSyncService).to receive(:new).and_return(sync_service)allow(sync_service).to receive(:call) do |file_links|ServiceResult.success(result: file_links.each { |file_link| file_link.origin_permission = :view })@@ -418,7 +418,7 @@ describe 'API v3 file links resource' doit 'is successful' doexpect(subject.status).to be 204- expect(::Storages::FileLink.exists?(id: file_link.id)).to be false+ expect(Storages::FileLink.exists?(id: file_link.id)).to be falseendcontext 'if user has no view permissions' dodiff --git a/modules/storages/spec/requests/api/v3/storages/storage_files_spec.rb b/modules/storages/spec/requests/api/v3/storages/storage_files_spec.rbindex 5125bc7157a..2ae8397a6c2 100644--- a/modules/storages/spec/requests/api/v3/storages/storage_files_spec.rb+++ b/modules/storages/spec/requests/api/v3/storages/storage_files_spec.rb@@ -45,7 +45,7 @@ describe 'API v3 storage files', content_type: :json, webmock: true dolet(:project_storage) { create(:project_storage, project:, storage:) }let(:authorize_url) { 'https://example.com/authorize' }- let(:connection_manager) { instance_double(::OAuthClients::ConnectionManager) }+ let(:connection_manager) { instance_double(OAuthClients::ConnectionManager) }subject(:last_response) doget path@@ -54,7 +54,7 @@ describe 'API v3 storage files', content_type: :json, webmock: true dobefore doallow(connection_manager).to receive(:get_authorization_uri).and_return(authorize_url)allow(connection_manager).to receive(:authorization_state).and_return(:connected)- allow(::OAuthClients::ConnectionManager).to receive(:new).and_return(connection_manager)+ allow(OAuthClients::ConnectionManager).to receive(:new).and_return(connection_manager)project_storagelogin_as current_userend@@ -99,7 +99,12 @@ describe 'API v3 storage files', content_type: :json, webmock: true dodescribe 'due to authorization failure' dobefore do- allow(storage_requests).to receive(:files_query).and_return(ServiceResult.failure(result: :not_authorized))+ allow(storage_requests).to receive(:files_query).and_return(+ ServiceResult.failure(+ result: :not_authorized,+ errors: Storages::StorageError.new(code: :not_authorized)+ )+ )endit { expect(last_response.status).to be(500) }@@ -107,7 +112,12 @@ describe 'API v3 storage files', content_type: :json, webmock: true dodescribe 'due to internal error' dobefore do- allow(storage_requests).to receive(:files_query).and_return(ServiceResult.failure(result: :error))+ allow(storage_requests).to receive(:files_query).and_return(+ ServiceResult.failure(+ result: :error,+ errors: Storages::StorageError.new(code: :error)+ )+ )endit { expect(last_response.status).to be(500) }@@ -115,7 +125,12 @@ describe 'API v3 storage files', content_type: :json, webmock: true dodescribe 'due to not found' dobefore do- allow(storage_requests).to receive(:files_query).and_return(ServiceResult.failure(result: :not_found))+ allow(storage_requests).to receive(:files_query).and_return(+ ServiceResult.failure(+ result: :not_found,+ errors: Storages::StorageError.new(code: :not_found)+ )+ )endit { expect(last_response.status).to be(404) }@@ -126,7 +141,10 @@ describe 'API v3 storage files', content_type: :json, webmock: true dolet(:files_query) doStruct.new('FilesQuery', :error) dodef query(_)- ServiceResult.failure(result: error)+ ServiceResult.failure(+ result: error,+ errors: Storages::StorageError.new(code: error)+ )endend.new(error)end@@ -180,7 +198,7 @@ describe 'API v3 storage files', content_type: :json, webmock: true doit doexpect(subject)- .to(be_json_eql("#{::API::V3::URN_PREFIX}storages:upload_link:no_link_provided".to_json)+ .to(be_json_eql("#{API::V3::URN_PREFIX}storages:upload_link:no_link_provided".to_json).at_path('_links/self/href'))end@@ -198,7 +216,12 @@ describe 'API v3 storage files', content_type: :json, webmock: true dodescribe 'due to authorization failure' dobefore do- allow(storage_requests).to receive(:upload_link_query).and_return(ServiceResult.failure(result: :not_authorized))+ allow(storage_requests).to receive(:upload_link_query).and_return(+ ServiceResult.failure(+ result: :not_authorized,+ errors: Storages::StorageError.new(code: :not_authorized)+ )+ )endit { expect(last_response.status).to be(500) }@@ -206,7 +229,12 @@ describe 'API v3 storage files', content_type: :json, webmock: true dodescribe 'due to internal error' dobefore do- allow(storage_requests).to receive(:upload_link_query).and_return(ServiceResult.failure(result: :error))+ allow(storage_requests).to receive(:upload_link_query).and_return(+ ServiceResult.failure(+ result: :error,+ errors: Storages::StorageError.new(code: :error)+ )+ )endit { expect(last_response.status).to be(500) }@@ -214,7 +242,12 @@ describe 'API v3 storage files', content_type: :json, webmock: true dodescribe 'due to not found' dobefore do- allow(storage_requests).to receive(:upload_link_query).and_return(ServiceResult.failure(result: :not_found))+ allow(storage_requests).to receive(:upload_link_query).and_return(+ ServiceResult.failure(+ result: :not_found,+ errors: Storages::StorageError.new(code: :not_found)+ )+ )endit { expect(last_response.status).to be(404) }diff --git a/modules/storages/spec/requests/api/v3/storages/storages_spec.rb b/modules/storages/spec/requests/api/v3/storages/storages_spec.rbindex d1bd08c114b..6c18823965b 100644--- a/modules/storages/spec/requests/api/v3/storages/storages_spec.rb+++ b/modules/storages/spec/requests/api/v3/storages/storages_spec.rb@@ -45,7 +45,7 @@ describe 'API v3 storages resource', content_type: :json, webmock: true dolet(:project_storage) { create(:project_storage, project:, storage:) }let(:authorize_url) { 'https://example.com/authorize' }- let(:connection_manager) { instance_double(::OAuthClients::ConnectionManager) }+ let(:connection_manager) { instance_double(OAuthClients::ConnectionManager) }subject(:last_response) doget path@@ -54,7 +54,7 @@ describe 'API v3 storages resource', content_type: :json, webmock: true dobefore doallow(connection_manager).to receive(:get_authorization_uri).and_return(authorize_url)allow(connection_manager).to receive(:authorization_state).and_return(:connected)- allow(::OAuthClients::ConnectionManager).to receive(:new).and_return(connection_manager)+ allow(OAuthClients::ConnectionManager).to receive(:new).and_return(connection_manager)project_storagelogin_as current_userend@@ -196,7 +196,7 @@ describe 'API v3 storages resource', content_type: :json, webmock: true dolet(:authorization_state) { :connected }include_examples 'a storage authorization result',- expected: ::API::V3::Storages::URN_CONNECTION_CONNECTED,+ expected: API::V3::Storages::URN_CONNECTION_CONNECTED,has_authorize_link: falseend@@ -204,7 +204,7 @@ describe 'API v3 storages resource', content_type: :json, webmock: true dolet(:authorization_state) { :failed_authorization }include_examples 'a storage authorization result',- expected: ::API::V3::Storages::URN_CONNECTION_AUTH_FAILED,+ expected: API::V3::Storages::URN_CONNECTION_AUTH_FAILED,has_authorize_link: trueend@@ -212,7 +212,7 @@ describe 'API v3 storages resource', content_type: :json, webmock: true dolet(:authorization_state) { :error }include_examples 'a storage authorization result',- expected: ::API::V3::Storages::URN_CONNECTION_ERROR,+ expected: API::V3::Storages::URN_CONNECTION_ERROR,has_authorize_link: falseendenddiff --git a/modules/storages/spec/services/storages/storages/set_attributes_service_spec.rb b/modules/storages/spec/services/storages/storages/set_attributes_service_spec.rbindex a520651e61c..71b69aa6fc3 100644--- a/modules/storages/spec/services/storages/storages/set_attributes_service_spec.rb+++ b/modules/storages/spec/services/storages/storages/set_attributes_service_spec.rb@@ -28,11 +28,11 @@require 'spec_helper'-describe ::Storages::Storages::SetAttributesService, type: :model do+describe Storages::Storages::SetAttributesService, type: :model dolet(:current_user) { build_stubbed(:admin) }let(:contract_instance) do- contract = instance_double(::Storages::Storages::BaseContract, 'contract_instance')+ contract = instance_double(Storages::Storages::BaseContract, 'contract_instance')allow(contract).to receive(:validate).and_return(contract_valid)@@ -52,13 +52,13 @@ describe ::Storages::Storages::SetAttributesService, type: :model docontract_class:,contract_options: {})end- let(:model_instance) { ::Storages::Storage.new }+ let(:model_instance) { Storages::Storage.new }let(:contract_class) do- allow(::Storages::Storages::CreateContract)+ allow(Storages::Storages::CreateContract).to receive(:new).and_return(contract_instance)- ::Storages::Storages::CreateContract+ Storages::Storages::CreateContractendlet(:params) { { provider_type: Storages::Storage::PROVIDER_TYPE_NEXTCLOUD } }