gitlabhq/app/observers/issue_observer.rb

31 lines
658 B
Ruby
Raw Normal View History

class IssueObserver < BaseObserver
cattr_accessor :current_user
def after_create(issue)
notification.new_issue(issue, current_user)
end
2013-02-18 10:10:58 +01:00
def after_close(issue, transition)
notification.close_issue(issue, current_user)
2013-02-18 10:10:58 +01:00
create_note(issue)
end
def after_reopen(issue, transition)
create_note(issue)
end
def after_update(issue)
if issue.is_being_reassigned?
notification.reassigned_issue(issue, current_user)
end
end
protected
# Create issue note with service comment like 'Status changed to closed'
2013-02-18 10:10:58 +01:00
def create_note(issue)
Note.create_status_change_note(issue, current_user, issue.state)
end
end