Implement notify parameter for WP PATCH endpoint

pull/2140/head
Hagen Schink 10 years ago
parent 0308b46624
commit dff6adc6c1
  1. 10
      lib/api/v3/work_packages/work_packages_api.rb

@ -40,6 +40,14 @@ module API
helpers do
attr_reader :work_package
def save_work_package
send_notifications = !(params.has_key?(:notify) && params[:notify] == 'false')
UserMailer.with_deliveries(send_notifications) do
@representer.represented.save
end
end
def decorate_work_package(work_package)
@representer = ::API::V3::WorkPackages::WorkPackageRepresenter.new(work_package, { current_user: current_user }, :activities, :users)
end
@ -81,7 +89,7 @@ module API
@representer.from_json(patch_request_body)
if patch_request_valid? && @representer.represented.save
if patch_request_valid? && save_work_package
decorate_work_package(@work_package.reload)
@representer
else

Loading…
Cancel
Save