BigW Consortium Gitlab

issue_observer.rb 786 Bytes
Newer Older
1
class IssueObserver < BaseObserver
2
  def after_create(issue)
3
    notification.new_issue(issue, current_user)
4 5

    issue.create_cross_references!(issue.project, current_user)
6 7
  end

Andrew8xx8 committed
8
  def after_close(issue, transition)
9
    notification.close_issue(issue, current_user)
10

Andrew8xx8 committed
11 12 13 14 15 16 17 18
    create_note(issue)
  end

  def after_reopen(issue, transition)
    create_note(issue)
  end

  def after_update(issue)
19 20 21
    if issue.is_being_reassigned?
      notification.reassigned_issue(issue, current_user)
    end
22 23

    issue.notice_added_references(issue.project, current_user)
24 25
  end

26 27
  protected

28
  # Create issue note with service comment like 'Status changed to closed'
Andrew8xx8 committed
29
  def create_note(issue)
30
    Note.create_status_change_note(issue, issue.project, current_user, issue.state, current_commit)
Andrew8xx8 committed
31
  end
32
end