Commit 5abc0108 authored by Peter Leitzen's avatar Peter Leitzen

Merge branch '207080-combine-send-email-calls' into 'master'

Move send_email? to IncidentManagement::Settings

Closes #207080

See merge request gitlab-org/gitlab!37808
parents b341cb26 06f04b57
# frozen_string_literal: true
module IncidentManagement
module Settings
include Gitlab::Utils::StrongMemoize
delegate :send_email?, to: :incident_management_setting
def incident_management_setting
strong_memoize(:incident_management_setting) do
project.incident_management_setting ||
......
......@@ -58,10 +58,6 @@ module Projects
AlertManagement::Alert.not_resolved.for_fingerprint(project, fingerprint).first
end
def send_email?
incident_management_setting.send_email?
end
def process_incident_issues(alert)
return if alert.issue
......
......@@ -42,10 +42,6 @@ module Projects
Gitlab::Utils::DeepSize.new(params).valid?
end
def send_email?
incident_management_setting.send_email && firings.any?
end
def firings
@firings ||= alerts_by_status('firing')
end
......@@ -125,6 +121,8 @@ module Projects
end
def send_alert_email
return unless firings.any?
notification_service
.async
.prometheus_alerts_fired(project, firings)
......
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