diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-12-04 15:49:22 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-12-04 15:49:22 +0300 |
commit | 87b33961d768d74b23df9fba398e0d59aeb511d3 (patch) | |
tree | 5a145b3963003f91d2c770d0797658bd56d1df89 /app | |
parent | ffc45b49acc4b4c7cdc97b91f131bbc154442e5b (diff) | |
parent | e7c64c9da34909c7f67b7da48771d317ef20d159 (diff) |
Merge branch '38862-email-notifications-not-sent-as-expected' into 'master'
Resolve "Email notifications not sent as expected"
Closes #38862
See merge request gitlab-org/gitlab-ce!15686
Diffstat (limited to 'app')
-rw-r--r-- | app/services/notification_recipient_service.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/app/services/notification_recipient_service.rb b/app/services/notification_recipient_service.rb index c9f07c140f7..3eb8cfcca9b 100644 --- a/app/services/notification_recipient_service.rb +++ b/app/services/notification_recipient_service.rb @@ -98,6 +98,12 @@ module NotificationRecipientService self << [target.participants(user), :participating] end + def add_mentions(user, target:) + return unless target.respond_to?(:mentioned_users) + + self << [target.mentioned_users(user), :mention] + end + # Get project/group users with CUSTOM notification level def add_custom_notifications user_ids = [] @@ -227,6 +233,11 @@ module NotificationRecipientService add_subscribed_users if [:new_issue, :new_merge_request].include?(custom_action) + # These will all be participants as well, but adding with the :mention + # type ensures that users with the mention notification level will + # receive them, too. + add_mentions(current_user, target: target) + add_labels_subscribers end end @@ -263,7 +274,7 @@ module NotificationRecipientService def build! # Add all users participating in the thread (author, assignee, comment authors) add_participants(note.author) - self << [note.mentioned_users, :mention] + add_mentions(note.author, target: note) unless note.for_personal_snippet? # Merge project watchers |