Skip to content

Commit

Permalink
Merge pull request #17403 from opf/code-maintenance/59468-api-remove-…
Browse files Browse the repository at this point in the history
…embedding-of-file-links-collection-from-work-package-resource

[59468] Removed embedded file links colelction from work package resource
  • Loading branch information
apfohl authored Dec 11, 2024
2 parents 49e5ac2 + 33276fc commit b7e9752
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,6 @@ module FileLinkRelationRepresenter
method: :post
}
end

property :file_links,
embedded: true,
exec_context: :decorator,
if: ->(*) { embed_links && current_user.allowed_in_project?(:view_file_links, represented.project) },
uncacheable: true

def file_links
::API::V3::FileLinks::FileLinkCollectionRepresenter.new(represented.file_links,
self_link: api_v3_paths.file_links(represented.id),
current_user:)
end
end
end
end
Expand Down
10 changes: 5 additions & 5 deletions spec/requests/api/v3/work_packages/create_resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
end

it "creates a work package" do
expect(WorkPackage.all.count).to eq(1)
expect(WorkPackage.count).to eq(1)
end

it "uses the given parameters" do
Expand Down Expand Up @@ -152,7 +152,7 @@
it_behaves_like "multiple errors", 422

it "does not create a work package" do
expect(WorkPackage.all.count).to eq(0)
expect(WorkPackage.count).to eq(0)
end
end

Expand All @@ -176,7 +176,7 @@
end

it "does not create a work package" do
expect(WorkPackage.all.count).to eq(0)
expect(WorkPackage.count).to eq(0)
end
end

Expand Down Expand Up @@ -227,7 +227,7 @@
end

it "does not create a work package" do
expect(WorkPackage.all.count).to eq(0)
expect(WorkPackage.count).to eq(0)
end
end

Expand Down Expand Up @@ -310,7 +310,7 @@
expect(last_response.body).to be_json_eql(
api_v3_paths.file_links(work_package.id).to_json
).at_path("_links/fileLinks/href")
expect(last_response.body).to be_json_eql("1").at_path("_embedded/fileLinks/total")
expect(last_response.body).to have_json_path("_links/addFileLink")
end
end
end
Expand Down

0 comments on commit b7e9752

Please sign in to comment.