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
[#40228] fixed scope of get all file links of wp
Eric Schubert6f4a2d108519
diff --git a/modules/storages/lib/api/v3/file_links/file_links_api.rb b/modules/storages/lib/api/v3/file_links/file_links_api.rbindex 112f4351384..6cc31bf96bc 100644--- a/modules/storages/lib/api/v3/file_links/file_links_api.rb+++ b/modules/storages/lib/api/v3/file_links/file_links_api.rb@@ -47,7 +47,7 @@ module API# A helper is used to define the behaviour at GET /api/v3/work_packages/:id/file_linksget &::API::V3::Utilities::Endpoints::Index.new(model: ::Storages::FileLink,- scope: -> { visible_file_links_scope },+ scope: -> { visible_file_links_scope.where(container_id: @work_package.id) },self_path: -> { api_v3_paths.file_links(params[:id]) }).mountdiff --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 6813a468720..9851abfae38 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@@ -38,9 +38,8 @@ describe 'API v3 file links resource', type: :request docreate(:user, member_in_project: project, member_with_permissions: permissions)end- let(:work_package) do- create(:work_package, author: current_user, project: project)- end+ let(:work_package) { create(:work_package, author: current_user, project: project) }+ let(:another_work_package) { create(:work_package, author: current_user, project: project) }let(:storage) docreate(:storage, creator: current_user)@@ -49,6 +48,9 @@ describe 'API v3 file links resource', type: :request dolet(:file_link) docreate(:file_link, creator: current_user, container: work_package, storage: storage)end+ let(:another_file_link) do+ create(:file_link, creator: current_user, container: another_work_package, storage: storage)+ endsubject(:response) { last_response }@@ -61,13 +63,10 @@ describe 'API v3 file links resource', type: :request dobefore dofile_link+ another_file_linkget pathend- it 'is successful' do- expect(subject.status).to be 200- end-it_behaves_like 'API V3 collection response', 1, 1, 'FileLink', 'Collection' dolet(:elements) { [file_link] }end