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