app/models/approval/respond_form/cancel.rb in approval-0.5.0 vs app/models/approval/respond_form/cancel.rb in approval-0.6.0
- old
+ new
@@ -2,14 +2,16 @@
module RespondForm
class Cancel < Base
private
def prepare
- ::Approval::Request.transaction do
- request.lock!
- request.assign_attributes(state: :cancelled, cancelled_at: Time.current, respond_user_id: user.id)
- request.comments.new(user_id: user.id, content: reason)
- yield(request)
+ instrument "cancel" do |payload|
+ ::Approval::Request.transaction do
+ request.lock!
+ request.assign_attributes(state: :cancelled, cancelled_at: Time.current, respond_user_id: user.id)
+ payload[:comment] = request.comments.new(user_id: user.id, content: reason)
+ yield(request)
+ end
end
end
end
end
end