Duplicate code removed from IssueObserver#after_update
This commit is contained in:
parent
2cb0a62f7d
commit
43cad71f1a
|
@ -10,17 +10,13 @@ class IssueObserver < ActiveRecord::Observer
|
||||||
def after_update(issue)
|
def after_update(issue)
|
||||||
send_reassigned_email(issue) if issue.is_being_reassigned?
|
send_reassigned_email(issue) if issue.is_being_reassigned?
|
||||||
|
|
||||||
if issue.is_being_closed?
|
status = nil
|
||||||
Note.create_status_change_note(issue, current_user, 'closed')
|
status = 'closed' if issue.is_being_closed?
|
||||||
|
status = 'reopened' if issue.is_being_reopened?
|
||||||
|
if status
|
||||||
|
Note.create_status_change_note(issue, current_user, status)
|
||||||
[issue.author, issue.assignee].compact.each do |recipient|
|
[issue.author, issue.assignee].compact.each do |recipient|
|
||||||
Notify.issue_status_changed_email(recipient.id, issue.id, 'closed', current_user)
|
Notify.issue_status_changed_email(recipient.id, issue.id, status, current_user)
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if issue.is_being_reopened?
|
|
||||||
Note.create_status_change_note(issue, current_user, 'reopened')
|
|
||||||
[issue.author, issue.assignee].compact.each do |recipient|
|
|
||||||
Notify.issue_status_changed_email(recipient.id, issue.id, 'reopened', current_user)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue