diff options
Diffstat (limited to 'app/mailers/emails')
-rw-r--r-- | app/mailers/emails/members.rb | 4 | ||||
-rw-r--r-- | app/mailers/emails/pipelines.rb | 3 | ||||
-rw-r--r-- | app/mailers/emails/projects.rb | 23 |
3 files changed, 28 insertions, 2 deletions
diff --git a/app/mailers/emails/members.rb b/app/mailers/emails/members.rb index d1870065845..fe2d2891547 100644 --- a/app/mailers/emails/members.rb +++ b/app/mailers/emails/members.rb @@ -6,6 +6,8 @@ module Emails include MembersHelper include Gitlab::Experiment::Dsl + INITIAL_INVITE = 'initial_email' + included do helper_method :member_source, :member helper_method :experiment @@ -53,6 +55,8 @@ module Emails return unless member_exists? + Gitlab::Tracking.event(self.class.name, 'invite_email_sent', label: 'invite_email', property: member_id.to_s) + mail(to: member.invite_email, subject: invite_email_subject, **invite_email_headers) do |format| format.html { render layout: 'unknown_user_mailer' } format.text { render layout: 'unknown_user_mailer' } diff --git a/app/mailers/emails/pipelines.rb b/app/mailers/emails/pipelines.rb index fb1f70723fd..1b27d062391 100644 --- a/app/mailers/emails/pipelines.rb +++ b/app/mailers/emails/pipelines.rb @@ -32,7 +32,7 @@ module Emails # thousand times. This could be potentially expensive in a loop, and # recipients would contain all project watchers so it could be a lot. mail(bcc: recipients, - subject: pipeline_subject(status)) do |format| + subject: subject(pipeline_subject(status))) do |format| format.html { render layout: 'mailer' } format.text { render layout: 'mailer' } end @@ -53,7 +53,6 @@ module Emails subject = [] subject << "#{status} pipeline for #{@pipeline.source_ref}" - subject << @project.name if @project subject << @pipeline.short_sha subject.join(' | ') 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 |