Commit bfebf108 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

reject current_user from close issue emails

parent 4b395045
...@@ -21,7 +21,12 @@ class NotificationService ...@@ -21,7 +21,12 @@ class NotificationService
# * project team members with notification level higher then Participating # * project team members with notification level higher then Participating
# #
def close_issue(issue, current_user) def close_issue(issue, current_user)
[issue.author, issue.assignee].compact.uniq.each do |recipient| recipients = [issue.author, issue.assignee].compact.uniq
# Dont send email to me when I close an issue
recipients.reject! { |u| u == current_user }
recipients.each do |recipient|
Notify.delay.issue_status_changed_email(recipient.id, issue.id, issue.state, current_user.id) Notify.delay.issue_status_changed_email(recipient.id, issue.id, issue.state, current_user.id)
end end
end end
...@@ -32,7 +37,10 @@ class NotificationService ...@@ -32,7 +37,10 @@ class NotificationService
# * issue assignee if his notification level is not Disabled # * issue assignee if his notification level is not Disabled
# #
def reassigned_issue(issue, current_user) def reassigned_issue(issue, current_user)
recipient_ids = [issue.assignee_id, issue.assignee_id_was].keep_if {|id| id && id != current_user.id } recipient_ids = [issue.assignee_id, issue.assignee_id_was].compact.uniq
# Reject me from recipients if I reassign an issue
recipient_ids.reject! { |id| id == current_user.id }
recipient_ids.each do |recipient_id| recipient_ids.each do |recipient_id|
Notify.delay.reassigned_issue_email(recipient_id, issue.id, issue.assignee_id_was) Notify.delay.reassigned_issue_email(recipient_id, issue.id, issue.assignee_id_was)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment