diff options
author | Rémy Coutable <remy@rymai.me> | 2016-01-15 19:57:45 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-01-15 19:57:45 +0300 |
commit | 30a4f4c9e0cc44b67ea6041b8aef01196649b8d3 (patch) | |
tree | 366c7e542e583a1fa3af67227e5cd4717ce9491b /app/services | |
parent | 55ae5394a05fbde53067336a17ff2f03733775a0 (diff) |
This will ensure previous assignee gets an email even if his notif level is "on mention"
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/notification_service.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb index 60b86914a38..ca8a41d93b8 100644 --- a/app/services/notification_service.rb +++ b/app/services/notification_service.rb @@ -376,10 +376,10 @@ class NotificationService end def reassign_resource_email(target, project, current_user, method) - previous_assignee_id = previous_record(target, "assignee_id") + previous_assignee_id = previous_record(target, 'assignee_id') previous_assignee = User.find_by(id: previous_assignee_id) if previous_assignee_id - recipients = build_recipients(target, project, current_user, action: :reassign, extra_recipients: [previous_assignee]) + recipients = build_recipients(target, project, current_user, action: :reassign, previous_assignee: previous_assignee) recipients.each do |recipient| mailer.send( @@ -400,11 +400,9 @@ class NotificationService end end - def build_recipients(target, project, current_user, action: nil, extra_recipients: nil) + def build_recipients(target, project, current_user, action: nil, previous_assignee: nil) recipients = target.participants(current_user) - recipients = recipients.concat(extra_recipients).compact.uniq if extra_recipients - recipients = add_project_watchers(recipients, project) recipients = reject_mention_users(recipients, project) @@ -412,6 +410,7 @@ class NotificationService # new assignee to the list of recipients after we rejected users with # the "on mention" notification level if action == :reassign + recipients << previous_assignee if previous_assignee recipients << target.assignee end |