diff options
Diffstat (limited to 'app/mailers/emails/projects.rb')
-rw-r--r-- | app/mailers/emails/projects.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/mailers/emails/projects.rb b/app/mailers/emails/projects.rb index 5c957437039..fdf40a77ca4 100644 --- a/app/mailers/emails/projects.rb +++ b/app/mailers/emails/projects.rb @@ -55,6 +55,19 @@ module Emails reply_to: @message.reply_to, subject: @message.subject) end + + def prometheus_alert_fired_email(project_id, user_id, alert_payload) + @project = ::Project.find(project_id) + user = ::User.find(user_id) + + @alert = ::Gitlab::Alerting::Alert + .new(project: @project, payload: alert_payload) + .present + return unless @alert.valid? + + subject_text = "Alert: #{@alert.full_title}" + mail(to: user.notification_email_for(@project.group), subject: subject(subject_text)) + end end end |