2013-03-26 12:11:38 -04:00
|
|
|
class IssueObserver < BaseObserver
|
2012-05-17 17:23:34 -04:00
|
|
|
def after_create(issue)
|
2013-03-26 03:47:40 -04:00
|
|
|
notification.new_issue(issue, current_user)
|
2012-05-17 17:23:34 -04:00
|
|
|
end
|
|
|
|
|
2013-02-18 04:10:58 -05:00
|
|
|
def after_close(issue, transition)
|
2013-03-26 03:47:40 -04:00
|
|
|
notification.close_issue(issue, current_user)
|
2012-08-29 03:48:17 -04:00
|
|
|
|
2013-02-18 04:10:58 -05:00
|
|
|
create_note(issue)
|
|
|
|
end
|
|
|
|
|
|
|
|
def after_reopen(issue, transition)
|
|
|
|
create_note(issue)
|
|
|
|
end
|
|
|
|
|
|
|
|
def after_update(issue)
|
2013-03-26 03:47:40 -04:00
|
|
|
if issue.is_being_reassigned?
|
|
|
|
notification.reassigned_issue(issue, current_user)
|
|
|
|
end
|
2012-05-20 14:25:34 -04:00
|
|
|
end
|
|
|
|
|
2012-06-20 21:23:05 -04:00
|
|
|
protected
|
|
|
|
|
2013-03-26 03:47:40 -04:00
|
|
|
# Create issue note with service comment like 'Status changed to closed'
|
2013-02-18 04:10:58 -05:00
|
|
|
def create_note(issue)
|
2013-04-25 10:15:33 -04:00
|
|
|
Note.create_status_change_note(issue, issue.project, current_user, issue.state)
|
2013-02-18 04:10:58 -05:00
|
|
|
end
|
2012-05-17 17:23:34 -04:00
|
|
|
end
|