Skip to content

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

[59468] Removed embedded file links colelction from work package resource

Andreas Pfohl33276fcdfab4
diff --git a/modules/storages/lib/api/v3/file_links/file_link_relation_representer.rb b/modules/storages/lib/api/v3/file_links/file_link_relation_representer.rb
index f373be81cdd..58b725ad70e 100644
--- a/modules/storages/lib/api/v3/file_links/file_link_relation_representer.rb
+++ b/modules/storages/lib/api/v3/file_links/file_link_relation_representer.rb
@@ -45,18 +45,6 @@ module API
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
diff --git a/spec/requests/api/v3/work_packages/create_resource_spec.rb b/spec/requests/api/v3/work_packages/create_resource_spec.rb
index cc6ff6015d5..de07c44385a 100644
--- a/spec/requests/api/v3/work_packages/create_resource_spec.rb
+++ b/spec/requests/api/v3/work_packages/create_resource_spec.rb
@@ -113,7 +113,7 @@ RSpec.describe "API v3 Work package resource",
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
@@ -152,7 +152,7 @@ RSpec.describe "API v3 Work package resource",
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
@@ -176,7 +176,7 @@ RSpec.describe "API v3 Work package resource",
end
it "does not create a work package" do
- expect(WorkPackage.all.count).to eq(0)
+ expect(WorkPackage.count).to eq(0)
end
end
@@ -227,7 +227,7 @@ RSpec.describe "API v3 Work package resource",
end
it "does not create a work package" do
- expect(WorkPackage.all.count).to eq(0)
+ expect(WorkPackage.count).to eq(0)
end
end
@@ -310,7 +310,7 @@ RSpec.describe "API v3 Work package resource",
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