diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2018-02-20 17:59:18 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2018-02-20 17:59:18 +0300 |
commit | 5aa4d7bfb4a3ffa7881bdba0a0dcc50cdb245684 (patch) | |
tree | 977602ffd37d6b248be78241635119485ec9c73d /app/services | |
parent | 3619c9174558bd2b2ae625ac6db480c437eb8484 (diff) | |
parent | b876a52bf7c2287d438ff8df371720c5bb75ed51 (diff) |
Merge branch 'master' into 42643-persist-external-ip-of-ingress-controller-gke
* master: (30 commits)
Docs: Pages - clean up articles
Only use features for events
Put all event metrics exposed to prometheus behind a feature flag
Add version which LFS lock was introduced
Remove unecessary validate: true from belongs_to :project
fix broken specs
remove common_d3 bundle
remove graphs_show webpack bundle
Chart.html.haml refactor
Remove extraneous tests from Issues API spec
[GH Import] Create an empty wiki if wiki import failed
Resolve "group request membership mail with too long list of "To:""
Add changelog entry
Fix single digit value clipping
specify date format
Increase feature flag cache TTL to one hour
Convert Gitaly commit parent IDs to array as early as possible
Clarify changelog for squash encoding fix
Avoid slow File Lock checks when not used
Fix squash rebase not working when diff contained encoded data
...
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/notification_service.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb index 8c84ccfcc92..56e941d90ff 100644 --- a/app/services/notification_service.rb +++ b/app/services/notification_service.rb @@ -208,7 +208,12 @@ class NotificationService def new_access_request(member) return true unless member.notifiable?(:subscription) - mailer.member_access_requested_email(member.real_source_type, member.id).deliver_later + recipients = member.source.members.owners_and_masters + if fallback_to_group_owners_masters?(recipients, member) + recipients = member.source.group.members.owners_and_masters + end + + recipients.each { |recipient| deliver_access_request_email(recipient, member) } end def decline_access_request(member) @@ -435,4 +440,14 @@ class NotificationService def notifiable_users(*args) NotificationRecipientService.notifiable_users(*args) end + + def deliver_access_request_email(recipient, member) + mailer.member_access_requested_email(member.real_source_type, member.id, recipient.user.notification_email).deliver_later + end + + def fallback_to_group_owners_masters?(recipients, member) + return false if recipients.present? + + member.source.respond_to?(:group) && member.source.group + end end |