Merge pull request #1326 from AlexDenisov/issue_status_changed_notifications
Issue status changed notifications
This commit is contained in:
commit
ed954ebae2
5 changed files with 119 additions and 9 deletions
|
@ -83,6 +83,14 @@ class Notify < ActionMailer::Base
|
|||
subject: subject("access to project was granted"))
|
||||
end
|
||||
|
||||
def issue_status_changed_email(recipient_id, issue_id, status, updated_by_user_id)
|
||||
@issue = Issue.find issue_id
|
||||
@issue_status = status
|
||||
@updated_by = User.find updated_by_user_id
|
||||
mail(to: recipient(recipient_id),
|
||||
subject: subject("changed issue ##{@issue.id}", @issue.title))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Look up a User by their ID and return their email address
|
||||
|
|
|
@ -9,8 +9,16 @@ class IssueObserver < ActiveRecord::Observer
|
|||
|
||||
def after_update(issue)
|
||||
send_reassigned_email(issue) if issue.is_being_reassigned?
|
||||
Note.create_status_change_note(issue, current_user, 'closed') if issue.is_being_closed?
|
||||
Note.create_status_change_note(issue, current_user, 'reopened') if issue.is_being_reopened?
|
||||
|
||||
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)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
|
16
app/views/notify/issue_status_changed_email.html.haml
Normal file
16
app/views/notify/issue_status_changed_email.html.haml
Normal file
|
@ -0,0 +1,16 @@
|
|||
%td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"}
|
||||
%table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"}
|
||||
%tr
|
||||
%td{style: "font-size: 1px; line-height: 1px;", width: "21"}
|
||||
%td{align: "left", style: "padding: 20px 0 0;"}
|
||||
%h2{style: "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "}
|
||||
= "Issue was #{@issue_status} by #{@updated_by.name}"
|
||||
%td{style: "font-size: 1px; line-height: 1px;", width: "21"}
|
||||
%tr
|
||||
%td{style: "font-size: 1px; line-height: 1px;", width: "21"}
|
||||
%td{align: "left", style: "padding: 20px 0 0;"}
|
||||
%h2{style: "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "}
|
||||
= "Issue ##{@issue.id}"
|
||||
= link_to_gfm truncate(@issue.title, length: 45), project_issue_url(@issue.project, @issue), title: @issue.title
|
||||
%br
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue