# Class IssueObserver < ActiveRecord::Observer

- app/observers/issue_observer.rb

Methods

A
  - after_create,
  - after_update
S
  - send_reassigned_email

Instance Public methods
after_create(issue) Link

Source: show

    # File app/observers/issue_observer.rb, line 4
    def after_create(issue)
      if issue.assignee && issue.assignee != current_user
        Notify.new_issue_email(issue.id).deliver
      end
    end

after_update(issue) Link

Source: show

    # File app/observers/issue_observer.rb, line 10
    def after_update(issue)
      send_reassigned_email(issue) if issue.is_being_reassigned?

      status = nil
      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|
          Notify.issue_status_changed_email(recipient.id, issue.id, status, current_user.id).deliver
        end
      end
    end

Instance Protected methods
send_reassigned_email(issue) Link

Source: show

    # File app/observers/issue_observer.rb, line 26
    def send_reassigned_email(issue)
      recipient_ids = [issue.assignee_id, issue.assignee_id_was].keep_if {|id| id && id != current_user.id }

      recipient_ids.each do |recipient_id|
        Notify.reassigned_issue_email(recipient_id, issue.id, issue.assignee_id_was).deliver
      end
    end