reject current_user from close issue emails

This commit is contained in:
Dmitriy Zaporozhets 2013-03-26 11:06:24 +02:00
parent 4b3950456d
commit bfebf10850

View file

@ -21,7 +21,12 @@ class NotificationService
# * project team members with notification level higher then Participating
#
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)
end
end
@ -32,7 +37,10 @@ class NotificationService
# * issue assignee if his notification level is not Disabled
#
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|
Notify.delay.reassigned_issue_email(recipient_id, issue.id, issue.assignee_id_was)