Commit 938fdcec authored by Sean Arnold's avatar Sean Arnold

Only notify legacy way if escalations not enabled

parent bb4d25a5
......@@ -11,7 +11,7 @@ module EE
def complete_post_processing_tasks
super
notify_oncall if oncall_notification_recipients.present? && notifying_alert?
notify_oncall if !escalation_policies_available? && oncall_notification_recipients.present? && notifying_alert?
process_escalations
end
......@@ -35,6 +35,10 @@ module EE
end
end
def escalation_policies_available?
::Gitlab::IncidentManagement.escalation_policies_available?(project)
end
def delete_pending_escalations
# We use :delete_all here to avoid null constraint errors. (the default is :nullify).
alert.pending_escalations.delete_all(:delete_all)
......
......@@ -55,7 +55,7 @@ RSpec.describe AlertManagement::ProcessPrometheusAlertService do
stub_feature_flags(escalation_policies_mvc: project)
end
include_examples 'oncall users are correctly notified of firing alert'
it_behaves_like 'does not send on-call notification'
include_examples 'creates an escalation', 1
context 'existing alert is now resolved' do
......
......@@ -93,7 +93,7 @@ RSpec.describe Projects::Alerting::NotifyService do
stub_feature_flags(escalation_policies_mvc: project)
end
include_examples 'oncall users are correctly notified of firing alert'
it_behaves_like 'does not send on-call notification'
include_examples 'creates an escalation', 1
end
......
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