issues.rb 1.25 KB
Newer Older
1
2
module Emails
  module Issues
3
    def new_issue_email(recipient_id, issue_id)
4
5
      @issue = Issue.find(issue_id)
      @project = @issue.project
6
      mail(to: recipient(recipient_id), subject: subject("New issue ##{@issue.iid}", @issue.title))
7
8
9
10
    end

    def reassigned_issue_email(recipient_id, issue_id, previous_assignee_id)
      @issue = Issue.find(issue_id)
skv's avatar
skv committed
11
      @previous_assignee = User.find_by(id: previous_assignee_id) if previous_assignee_id
12
      @project = @issue.project
13
      mail(to: recipient(recipient_id), subject: subject("Changed issue ##{@issue.iid}", @issue.title))
14
15
    end

16
    def closed_issue_email(recipient_id, issue_id, updated_by_user_id)
17
18
19
20
      @issue = Issue.find issue_id
      @project = @issue.project
      @updated_by = User.find updated_by_user_id
      mail(to: recipient(recipient_id),
21
           subject: subject("Closed issue ##{@issue.iid}", @issue.title))
22
23
    end

24
25
26
27
28
29
    def issue_status_changed_email(recipient_id, issue_id, status, updated_by_user_id)
      @issue = Issue.find issue_id
      @issue_status = status
      @project = @issue.project
      @updated_by = User.find updated_by_user_id
      mail(to: recipient(recipient_id),
30
           subject: subject("Changed issue ##{@issue.iid}", @issue.title))
31
32
33
    end
  end
end