diff options
author | Rémy Coutable <remy@rymai.me> | 2016-06-20 12:10:37 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-06-20 12:10:37 +0200 |
commit | b31c5052f9acf5d9118b2b81b556199279e7ca30 (patch) | |
tree | de9e4acd94af878d2362029d7552cfe80d752414 /app/mailers | |
parent | 44b8b77e02423ce97f9abe80e0335f4f4c453c83 (diff) | |
download | gitlab-ce-b31c5052f9acf5d9118b2b81b556199279e7ca30.tar.gz |
Fallback to group's owners/masters when a project has none18757-fix
A project in a group can have no explicit owners/masters,
in that case we fallbacks to the group's owners/masters.
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/mailers')
-rw-r--r-- | app/mailers/emails/members.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/mailers/emails/members.rb b/app/mailers/emails/members.rb index 6dde2e9847d..45311690293 100644 --- a/app/mailers/emails/members.rb +++ b/app/mailers/emails/members.rb @@ -12,6 +12,11 @@ module Emails @member_id = member_id admins = member_source.members.owners_and_masters.includes(:user).pluck(:notification_email) + # A project in a group can have no explicit owners/masters, in that case + # we fallbacks to the group's owners/masters. + if admins.empty? && member_source.respond_to?(:group) && member_source.group + admins = member_source.group.members.owners_and_masters.includes(:user).pluck(:notification_email) + end mail(to: admins, subject: subject("Request to join the #{member_source.human_name} #{member_source.model_name.singular}")) |