Commit bfebf108508fa011294c36ad59a4943173c309b2
1 parent
4b395045
Exists in
master
and in
4 other branches
reject current_user from close issue emails
Showing
1 changed file
with
10 additions
and
2 deletions
Show diff stats
app/services/notification_service.rb
@@ -21,7 +21,12 @@ class NotificationService | @@ -21,7 +21,12 @@ class NotificationService | ||
21 | # * project team members with notification level higher then Participating | 21 | # * project team members with notification level higher then Participating |
22 | # | 22 | # |
23 | def close_issue(issue, current_user) | 23 | def close_issue(issue, current_user) |
24 | - [issue.author, issue.assignee].compact.uniq.each do |recipient| | 24 | + recipients = [issue.author, issue.assignee].compact.uniq |
25 | + | ||
26 | + # Dont send email to me when I close an issue | ||
27 | + recipients.reject! { |u| u == current_user } | ||
28 | + | ||
29 | + recipients.each do |recipient| | ||
25 | Notify.delay.issue_status_changed_email(recipient.id, issue.id, issue.state, current_user.id) | 30 | Notify.delay.issue_status_changed_email(recipient.id, issue.id, issue.state, current_user.id) |
26 | end | 31 | end |
27 | end | 32 | end |
@@ -32,7 +37,10 @@ class NotificationService | @@ -32,7 +37,10 @@ class NotificationService | ||
32 | # * issue assignee if his notification level is not Disabled | 37 | # * issue assignee if his notification level is not Disabled |
33 | # | 38 | # |
34 | def reassigned_issue(issue, current_user) | 39 | def reassigned_issue(issue, current_user) |
35 | - recipient_ids = [issue.assignee_id, issue.assignee_id_was].keep_if {|id| id && id != current_user.id } | 40 | + recipient_ids = [issue.assignee_id, issue.assignee_id_was].compact.uniq |
41 | + | ||
42 | + # Reject me from recipients if I reassign an issue | ||
43 | + recipient_ids.reject! { |id| id == current_user.id } | ||
36 | 44 | ||
37 | recipient_ids.each do |recipient_id| | 45 | recipient_ids.each do |recipient_id| |
38 | Notify.delay.reassigned_issue_email(recipient_id, issue.id, issue.assignee_id_was) | 46 | Notify.delay.reassigned_issue_email(recipient_id, issue.id, issue.assignee_id_was) |