summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2015-11-17 18:28:09 +0000
committerRobert Speicher <robert@gitlab.com>2015-11-17 18:28:09 +0000
commitb1abe90aeb7267359bbfd7c20163b61c0fe6df30 (patch)
tree646c36201587a2e4f7f5d66ebff4c7c39535652a /app
parentd431f3ec40e03ed4d65ef80bae2fb7a0558fd2d2 (diff)
parentf008b2d2dfd1b8030ec0634c223ca9f11d304e91 (diff)
downloadgitlab-ce-b1abe90aeb7267359bbfd7c20163b61c0fe6df30.tar.gz
Merge branch 'adamliesko/gitlab-ce-notification-upon-unassignment' into 'master'
Add notification to the former assignee upon unassignment Replaces !1769 Fixes #3395 See merge request !1818
Diffstat (limited to 'app')
-rw-r--r--app/services/notification_service.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb
index 4b871f072d4..bbfe755f44a 100644
--- a/app/services/notification_service.rb
+++ b/app/services/notification_service.rb
@@ -351,11 +351,13 @@ class NotificationService
end
def reassign_resource_email(target, project, current_user, method)
- assignee_id_was = previous_record(target, "assignee_id")
- recipients = build_recipients(target, project, current_user)
+ 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, [previous_assignee])
recipients.each do |recipient|
- mailer.send(method, recipient.id, target.id, assignee_id_was, current_user.id)
+ mailer.send(method, recipient.id, target.id, previous_assignee_id, current_user.id)
end
end
@@ -367,9 +369,11 @@ class NotificationService
end
end
- def build_recipients(target, project, current_user)
+ def build_recipients(target, project, current_user, extra_recipients = 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)
recipients = reject_muted_users(recipients, project)