summaryrefslogtreecommitdiff
path: root/app/services/issues
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-08-17 20:19:11 +0000
committerRobert Speicher <robert@gitlab.com>2016-08-17 20:19:11 +0000
commit3666f6987ea5a6f105c6fa146144f7310f0647a6 (patch)
treeef701a82e34503bf96f8876426276239360f50b0 /app/services/issues
parent7e6a177771a0dc148171e7a6b603b8bb9bfe5588 (diff)
parent2797cfbf604be698f5b0aaf7178a9aad78d2805b (diff)
downloadgitlab-ce-3666f6987ea5a6f105c6fa146144f7310f0647a6.tar.gz
Merge branch '2451-fix-mentions-in-issue-updates' into 'master'
Send notification emails when users are newly mentioned in issue or MR edits ## What does this MR do? Introduces "new mention in issue" and "new mention in MR" email notifications. Editing a Mentionable title or description and adding a mention to a user who was not previously mentioned will now send them a notification email, following usual permissions for doing so. ## Why was this MR needed? Issues & MRs may be edited to include mentions to new people. We don't currently send out email notifications of these edits to anyone, although they do create TODOs. This brings email notifications into parity with TODOs. ## What are the relevant issue numbers? Closes #2451 See merge request !5800
Diffstat (limited to 'app/services/issues')
-rw-r--r--app/services/issues/update_service.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb
index c7d406cc331..a2111b3806b 100644
--- a/app/services/issues/update_service.rb
+++ b/app/services/issues/update_service.rb
@@ -4,7 +4,7 @@ module Issues
update(issue)
end
- def handle_changes(issue, old_labels: [])
+ def handle_changes(issue, old_labels: [], old_mentioned_users: [])
if has_changes?(issue, old_labels: old_labels)
todo_service.mark_pending_todos_as_done(issue, current_user)
end
@@ -32,6 +32,11 @@ module Issues
if added_labels.present?
notification_service.relabeled_issue(issue, added_labels, current_user)
end
+
+ added_mentions = issue.mentioned_users - old_mentioned_users
+ if added_mentions.present?
+ notification_service.new_mentions_in_issue(issue, added_mentions, current_user)
+ end
end
def reopen_service