Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 12:08:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 12:08:42 +0300
commitb76ae638462ab0f673e5915986070518dd3f9ad3 (patch)
treebdab0533383b52873be0ec0eb4d3c66598ff8b91 /app/mailers
parent434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff)
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'app/mailers')
-rw-r--r--app/mailers/emails/members.rb4
-rw-r--r--app/mailers/emails/pipelines.rb3
-rw-r--r--app/mailers/emails/projects.rb23
-rw-r--r--app/mailers/previews/notify_preview.rb2
4 files changed, 29 insertions, 3 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
diff --git a/app/mailers/previews/notify_preview.rb b/app/mailers/previews/notify_preview.rb
index ceeb178e9c2..13b24e099c9 100644
--- a/app/mailers/previews/notify_preview.rb
+++ b/app/mailers/previews/notify_preview.rb
@@ -246,7 +246,7 @@ class NotifyPreview < ActionMailer::Preview
def cleanup
email = nil
- ActiveRecord::Base.transaction do
+ ActiveRecord::Base.transaction do # rubocop: disable Database/MultipleDatabases
email = yield
raise ActiveRecord::Rollback
end