Permalink
Browse files

reject current_user from close issue emails

  • Loading branch information...
dzaporozhets committed Mar 26, 2013
1 parent 4b39504 commit bfebf108508fa011294c36ad59a4943173c309b2
Showing with 10 additions and 2 deletions.
  1. +10 −2 app/services/notification_service.rb
@@ -21,7 +21,12 @@ def new_key(key)
# * 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 @@ def close_issue(issue, current_user)
# * 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)

0 comments on commit bfebf10

Please sign in to comment.