diff options
Diffstat (limited to 'app/mailers/emails/projects.rb')
-rw-r--r-- | app/mailers/emails/projects.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/mailers/emails/projects.rb b/app/mailers/emails/projects.rb index 2ae82b49609..06ba16f9724 100644 --- a/app/mailers/emails/projects.rb +++ b/app/mailers/emails/projects.rb @@ -60,9 +60,32 @@ module Emails @project = project @alert = alert.present + add_project_headers + add_alert_headers + subject_text = "Alert: #{@alert.email_title}" mail(to: user.notification_email_for(@project.group), subject: subject(subject_text)) end + + private + + def add_alert_headers + return unless @alert + + headers['X-GitLab-Alert-ID'] = @alert.id + headers['X-GitLab-Alert-IID'] = @alert.iid + headers['X-GitLab-NotificationReason'] = "alert_#{@alert.state}" + + add_incident_headers + end + + def add_incident_headers + incident = @alert.issue + return unless incident + + headers['X-GitLab-Incident-ID'] = incident.id + headers['X-GitLab-Incident-IID'] = incident.iid + end end end |