diff options
author | Heinrich Lee Yu <heinrich@gitlab.com> | 2019-07-18 20:04:43 +0300 |
---|---|---|
committer | Heinrich Lee Yu <heinrich@gitlab.com> | 2019-07-23 08:00:53 +0300 |
commit | 40d6d5e2d0123f1417bb5d3d1ead47bd525f8dac (patch) | |
tree | 1536ffad5f7c1a28ad2ca645a098a29b4bc2834d /app/models/user.rb | |
parent | 17fe03078d003dc61a456da8d3e41e3e52ba4f54 (diff) |
Make pipeline emails respect group email setting
When a user's notification email is set for a group, we
should use that for pipeline emails
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 0fd3daa3383..b439d1c0c16 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1259,6 +1259,11 @@ class User < ApplicationRecord end end + def notification_email_for(notification_group) + # Return group-specific email address if present, otherwise return global notification email address + notification_group&.notification_email_for(self) || notification_email + end + def notification_settings_for(source) if notification_settings.loaded? notification_settings.find do |notification| |