diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /app/mailers | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'app/mailers')
-rw-r--r-- | app/mailers/emails/in_product_marketing.rb | 25 | ||||
-rw-r--r-- | app/mailers/emails/issues.rb | 2 | ||||
-rw-r--r-- | app/mailers/emails/members.rb | 2 | ||||
-rw-r--r-- | app/mailers/emails/merge_requests.rb | 2 | ||||
-rw-r--r-- | app/mailers/emails/notes.rb | 2 | ||||
-rw-r--r-- | app/mailers/emails/profile.rb | 2 | ||||
-rw-r--r-- | app/mailers/emails/projects.rb | 2 | ||||
-rw-r--r-- | app/mailers/notify.rb | 2 | ||||
-rw-r--r-- | app/mailers/previews/notify_preview.rb | 8 |
9 files changed, 28 insertions, 19 deletions
diff --git a/app/mailers/emails/in_product_marketing.rb b/app/mailers/emails/in_product_marketing.rb index d21c3d13b10..97243660512 100644 --- a/app/mailers/emails/in_product_marketing.rb +++ b/app/mailers/emails/in_product_marketing.rb @@ -2,8 +2,6 @@ module Emails module InProductMarketing - include InProductMarketingHelper - FROM_ADDRESS = 'GitLab <team@gitlab.com>' CUSTOM_HEADERS = { from: FROM_ADDRESS, @@ -15,13 +13,11 @@ module Emails }.freeze def in_product_marketing_email(recipient_id, group_id, track, series) - @track = track - @series = series - @group = Group.find(group_id) + group = Group.find(group_id) + email = User.find(recipient_id).notification_email_for(group) + @message = Gitlab::Email::Message::InProductMarketing.for(track).new(group: group, series: series) - email = User.find(recipient_id).notification_email_for(@group) - subject = subject_line(track, series) - mail_to(to: email, subject: subject) + mail_to(to: email, subject: @message.subject_line) end private @@ -29,8 +25,17 @@ module Emails def mail_to(to:, subject:) custom_headers = Gitlab.com? ? CUSTOM_HEADERS : {} mail(to: to, subject: subject, **custom_headers) do |format| - format.html { render layout: nil } - format.text { render layout: nil } + format.html do + @message.format = :html + + render layout: nil + end + + format.text do + @message.format = :text + + render layout: nil + end end end end diff --git a/app/mailers/emails/issues.rb b/app/mailers/emails/issues.rb index c565df1a2ee..51c4779d8cf 100644 --- a/app/mailers/emails/issues.rb +++ b/app/mailers/emails/issues.rb @@ -139,4 +139,4 @@ module Emails end end -Emails::Issues.prepend_if_ee('EE::Emails::Issues') +Emails::Issues.prepend_mod_with('Emails::Issues') diff --git a/app/mailers/emails/members.rb b/app/mailers/emails/members.rb index f4d3676dc5c..674a9bfc4eb 100644 --- a/app/mailers/emails/members.rb +++ b/app/mailers/emails/members.rb @@ -167,4 +167,4 @@ module Emails end end -Emails::Members.prepend_if_ee('EE::Emails::Members') +Emails::Members.prepend_mod_with('Emails::Members') diff --git a/app/mailers/emails/merge_requests.rb b/app/mailers/emails/merge_requests.rb index e538b5e4718..2746b8b7188 100644 --- a/app/mailers/emails/merge_requests.rb +++ b/app/mailers/emails/merge_requests.rb @@ -167,4 +167,4 @@ module Emails end end -Emails::MergeRequests.prepend_if_ee('EE::Emails::MergeRequests') +Emails::MergeRequests.prepend_mod_with('Emails::MergeRequests') diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb index 4b56ff60f09..587c1479286 100644 --- a/app/mailers/emails/notes.rb +++ b/app/mailers/emails/notes.rb @@ -84,4 +84,4 @@ module Emails end end -Emails::Notes.prepend_if_ee('EE::Emails::Notes') +Emails::Notes.prepend_mod_with('Emails::Notes') diff --git a/app/mailers/emails/profile.rb b/app/mailers/emails/profile.rb index f967323f849..2efcba54c13 100644 --- a/app/mailers/emails/profile.rb +++ b/app/mailers/emails/profile.rb @@ -132,4 +132,4 @@ module Emails end end -Emails::Profile.prepend_if_ee('EE::Emails::Profile') +Emails::Profile.prepend_mod_with('Emails::Profile') diff --git a/app/mailers/emails/projects.rb b/app/mailers/emails/projects.rb index a4b7b140169..2ae82b49609 100644 --- a/app/mailers/emails/projects.rb +++ b/app/mailers/emails/projects.rb @@ -66,4 +66,4 @@ module Emails end end -Emails::Projects.prepend_if_ee('EE::Emails::Projects') +Emails::Projects.prepend_mod_with('Emails::Projects') diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index 5f5afef350b..dd75ab4bf03 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -223,4 +223,4 @@ class Notify < ApplicationMailer end end -Notify.prepend_if_ee('EE::Notify') +Notify.prepend_mod_with('Notify') diff --git a/app/mailers/previews/notify_preview.rb b/app/mailers/previews/notify_preview.rb index 5fda60a7408..df0d1774d6b 100644 --- a/app/mailers/previews/notify_preview.rb +++ b/app/mailers/previews/notify_preview.rb @@ -88,6 +88,10 @@ class NotifyPreview < ActionMailer::Preview Notify.issues_csv_email(user, project, '1997,Ford,E350', { truncated: false, rows_expected: 3, rows_written: 3 }).message end + def new_issue_email + Notify.new_issue_email(user.id, issue.id).message + end + def new_merge_request_email Notify.new_merge_request_email(user.id, merge_request.id).message end @@ -200,7 +204,7 @@ class NotifyPreview < ActionMailer::Preview end def issue - @merge_request ||= project.issues.first + @issue ||= project.issues.first end def merge_request @@ -251,4 +255,4 @@ class NotifyPreview < ActionMailer::Preview end end -NotifyPreview.prepend_if_ee('EE::Preview::NotifyPreview') +NotifyPreview.prepend_mod_with('Preview::NotifyPreview') |