Fix embedded watchers link in api v3 (messed up during merge)

pull/1630/head
Till Breuer 10 years ago
parent 8d5732e5d3
commit 13e57529d5
  1. 6
      lib/api/v3/work_packages/work_package_representer.rb

@ -147,7 +147,7 @@ module API
property :assignee, embedded: true, class: ::API::V3::Users::UserModel, decorator: ::API::V3::Users::UserRepresenter, if: -> (*) { !assignee.nil? }
collection :activities, embedded: true, class: ::API::V3::Activities::ActivityModel, decorator: ::API::V3::Activities::ActivityRepresenter
collection :watchers, embedded: true, class: ::API::V3::Users::UserModel, decorator: ::API::V3::Users::UserRepresenter
property :watchers, embedded: true, exec_context: :decorator
collection :attachments, embedded: true, class: ::API::V3::Attachments::AttachmentModel, decorator: ::API::V3::Attachments::AttachmentRepresenter
property :relations, embedded: true, exec_context: :decorator
@ -155,6 +155,10 @@ module API
'WorkPackage'
end
def watchers
represented.watchers.map{ |watcher| ::API::V3::Users::UserRepresenter.new(watcher, work_package: represented.work_package, current_user: @current_user) }
end
def relations
represented.relations.map{ |relation| RelationRepresenter.new(relation, work_package: represented.work_package) }
end

Loading…
Cancel
Save