summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2019-06-13 20:06:38 +0000
committerRobert Speicher <rspeicher@gmail.com>2019-06-13 20:06:38 +0000
commit21bf85553d257f0e1d80e63931ef7585c2afdae6 (patch)
tree9ad2e65414d4c725a7f6c4403fee462c128ab7bf
parente7a59b876e21ea25048533a3b289227b98f0139a (diff)
parentede045820f6dca8cb5dbf37c88635da21620c81e (diff)
downloadgitlab-ce-21bf85553d257f0e1d80e63931ef7585c2afdae6.tar.gz
Merge branch 'sh-omit-blocked-admins-from-notification' into 'master'
Omit blocked admins from repository check e-mails Closes #63019 See merge request gitlab-org/gitlab-ce!29507
-rw-r--r--app/mailers/repository_check_mailer.rb2
-rw-r--r--changelogs/unreleased/sh-omit-blocked-admins-from-notification.yml5
-rw-r--r--spec/mailers/repository_check_mailer_spec.rb10
3 files changed, 16 insertions, 1 deletions
diff --git a/app/mailers/repository_check_mailer.rb b/app/mailers/repository_check_mailer.rb
index a24d3476d0e..aa56ba1828b 100644
--- a/app/mailers/repository_check_mailer.rb
+++ b/app/mailers/repository_check_mailer.rb
@@ -15,7 +15,7 @@ class RepositoryCheckMailer < BaseMailer
end
mail(
- to: User.admins.pluck(:email),
+ to: User.admins.active.pluck(:email),
subject: "GitLab Admin | #{@message}"
)
end
diff --git a/changelogs/unreleased/sh-omit-blocked-admins-from-notification.yml b/changelogs/unreleased/sh-omit-blocked-admins-from-notification.yml
new file mode 100644
index 00000000000..82c5505892f
--- /dev/null
+++ b/changelogs/unreleased/sh-omit-blocked-admins-from-notification.yml
@@ -0,0 +1,5 @@
+---
+title: Omit blocked admins from repository check e-mails
+merge_request: 29507
+author:
+type: fixed
diff --git a/spec/mailers/repository_check_mailer_spec.rb b/spec/mailers/repository_check_mailer_spec.rb
index 384660f7221..3dce89f5be2 100644
--- a/spec/mailers/repository_check_mailer_spec.rb
+++ b/spec/mailers/repository_check_mailer_spec.rb
@@ -12,6 +12,16 @@ describe RepositoryCheckMailer do
expect(mail).to deliver_to admins.map(&:email)
end
+ it 'omits blocked admins' do
+ blocked = create(:admin, :blocked)
+ admins = create_list(:admin, 3)
+
+ mail = described_class.notify(1)
+
+ expect(mail.to).not_to include(blocked.email)
+ expect(mail).to deliver_to admins.map(&:email)
+ end
+
it 'mentions the number of failed checks' do
mail = described_class.notify(3)