app/models/approval/respond_form/reject.rb in approval-0.5.0 vs app/models/approval/respond_form/reject.rb in approval-0.6.0

- old
+ new

@@ -4,14 +4,16 @@ validate :ensure_user_cannot_respond_to_my_request private def prepare - ::Approval::Request.transaction do - request.lock! - request.assign_attributes(state: :rejected, rejected_at: Time.current, respond_user_id: user.id) - request.comments.new(user_id: user.id, content: reason) - yield(request) + instrument "reject" do |payload| + ::Approval::Request.transaction do + request.lock! + request.assign_attributes(state: :rejected, rejected_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