Commit 3ea8f2f2 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch '207488-reuse-notification-method' into 'master'

Use owners_and_maintainers_without_invites method in NotificationService#mirror_was_hard_failed

See merge request gitlab-org/gitlab!26437
parents d4ab5237 02e4494a
......@@ -38,13 +38,7 @@ module EE
def mirror_was_hard_failed(project)
return if project.emails_disabled?
recipients = project.members.active_without_invites_and_requests.owners_and_maintainers
if recipients.empty? && project.group
recipients = project.group.members.active_without_invites_and_requests.owners_and_maintainers
end
recipients.each do |recipient|
owners_and_maintainers_without_invites(project).each do |recipient|
mailer.mirror_was_hard_failed_email(project.id, recipient.user.id).deliver_later
end
end
......@@ -78,10 +72,10 @@ module EE
private
def owners_and_maintainers_without_invites(project)
recipients = project.members.active_without_invites_and_requests.owners_and_masters
recipients = project.members.active_without_invites_and_requests.owners_and_maintainers
if recipients.empty? && project.group
recipients = project.group.members.active_without_invites_and_requests.owners_and_masters
recipients = project.group.members.active_without_invites_and_requests.owners_and_maintainers
end
recipients
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe Projects::Prometheus::AlertPresenter do
let_it_be(:project) { create(:project) }
let_it_be(:project, reload: true) { create(:project) }
let(:presenter) { described_class.new(alert) }
let(:payload) { {} }
......@@ -174,7 +174,6 @@ describe Projects::Prometheus::AlertPresenter do
context 'create issue setting enabled' do
before do
create(:project_incident_management_setting, project: project, create_issue: true)
project.reload
end
it { is_expected.to eq(true) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment