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

remove watchers embedded in wp representer

ulferts8cb7ed632a60
diff --git a/lib/api/v3/work_packages/work_package_representer.rb b/lib/api/v3/work_packages/work_package_representer.rb
index bfaf9cf4f65..f307843ce94 100644
--- a/lib/api/v3/work_packages/work_package_representer.rb
+++ b/lib/api/v3/work_packages/work_package_representer.rb
@@ -411,16 +411,6 @@ module API
date_time_property :updated_at
- property :watchers,
- embedded: true,
- exec_context: :decorator,
- uncacheable: true,
- if: ->(*) {
- current_user_allowed_to(:view_work_package_watchers,
- context: represented.project) &&
- embed_links
- }
-
property :relations,
embedded: true,
exec_context: :decorator,
@@ -525,16 +515,6 @@ module API
super
end
- def watchers
- # TODO/LEGACY: why do we need to ensure a specific order here?
- watchers = represented.watcher_users.order(User::USER_FORMATS_STRUCTURE[Setting.user_format])
- self_link = api_v3_paths.work_package_watchers(represented.id)
-
- Users::UserCollectionRepresenter.new(watchers,
- self_link,
- current_user: current_user)
- end
-
def current_user_watcher?
represented.watchers.any? { |w| w.user_id == current_user.id }
end
diff --git a/spec/lib/api/v3/work_packages/work_package_representer_spec.rb b/spec/lib/api/v3/work_packages/work_package_representer_spec.rb
index b369ef14344..6e10ffff4e3 100644
--- a/spec/lib/api/v3/work_packages/work_package_representer_spec.rb
+++ b/spec/lib/api/v3/work_packages/work_package_representer_spec.rb
@@ -717,10 +717,6 @@ describe ::API::V3::WorkPackages::WorkPackageRepresenter do
let(:link) { 'watchers' }
let(:href) { api_v3_paths.work_package_watchers work_package.id }
end
-
- it 'embeds the watchers as collection' do
- is_expected.to be_json_eql('Collection'.to_json).at_path('_embedded/watchers/_type')
- end
end
context 'when the user is not allowed to see watchers' do