Omit blocked admins from repository check e-mails

Blocked admins should not receive notifications about failed repository
checks.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/63019
This commit is contained in:
Stan Hu 2019-06-11 13:44:45 -07:00
parent b05de5a583
commit ede045820f
3 changed files with 16 additions and 1 deletions

View file

@ -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

View file

@ -0,0 +1,5 @@
---
title: Omit blocked admins from repository check e-mails
merge_request: 29507
author:
type: fixed

View file

@ -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)