diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /app/mailers | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) | |
download | gitlab-ce-859a6fb938bb9ee2a317c46dfa4fcc1af49608f0.tar.gz |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'app/mailers')
-rw-r--r-- | app/mailers/emails/in_product_marketing.rb | 34 | ||||
-rw-r--r-- | app/mailers/emails/members.rb | 2 | ||||
-rw-r--r-- | app/mailers/emails/merge_requests.rb | 7 | ||||
-rw-r--r-- | app/mailers/notify.rb | 2 |
4 files changed, 45 insertions, 0 deletions
diff --git a/app/mailers/emails/in_product_marketing.rb b/app/mailers/emails/in_product_marketing.rb new file mode 100644 index 00000000000..0be9ec5f915 --- /dev/null +++ b/app/mailers/emails/in_product_marketing.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +module Emails + module InProductMarketing + include InProductMarketingHelper + + FROM_ADDRESS = 'GitLab <team@gitlab.com>'.freeze + CUSTOM_HEADERS = { + 'X-Mailgun-Track' => 'yes', + 'X-Mailgun-Track-Clicks' => 'yes', + 'X-Mailgun-Track-Opens' => 'yes', + 'X-Mailgun-Tag' => 'marketing' + }.freeze + + def in_product_marketing_email(recipient_id, group_id, track, series) + @track = track + @series = series + @group = Group.find(group_id) + + email = User.find(recipient_id).notification_email_for(@group) + subject = subject_line(track, series) + mail_to(to: email, subject: subject) + end + + private + + def mail_to(to:, subject:) + mail(to: to, subject: subject, from: FROM_ADDRESS, reply_to: FROM_ADDRESS, **CUSTOM_HEADERS) do |format| + format.html { render layout: nil } + format.text { render layout: nil } + end + end + end +end diff --git a/app/mailers/emails/members.rb b/app/mailers/emails/members.rb index 69f5fe1430a..f4d3676dc5c 100644 --- a/app/mailers/emails/members.rb +++ b/app/mailers/emails/members.rb @@ -4,9 +4,11 @@ module Emails module Members extend ActiveSupport::Concern include MembersHelper + include Gitlab::Experiment::Dsl included do helper_method :member_source, :member + helper_method :experiment end def member_access_requested_email(member_source_type, member_id, recipient_id) diff --git a/app/mailers/emails/merge_requests.rb b/app/mailers/emails/merge_requests.rb index 4faa1a11276..494d9875ce4 100644 --- a/app/mailers/emails/merge_requests.rb +++ b/app/mailers/emails/merge_requests.rb @@ -82,6 +82,13 @@ module Emails mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason)) end + def request_review_merge_request_email(recipient_id, merge_request_id, updated_by_user_id, reason = nil) + setup_merge_request_mail(merge_request_id, recipient_id) + + @updated_by = User.find(updated_by_user_id) + mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason)) + end + def merge_request_status_email(recipient_id, merge_request_id, status, updated_by_user_id, reason = nil) setup_merge_request_mail(merge_request_id, recipient_id) diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index ebf6dd68ec7..8f947ea7113 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -21,6 +21,7 @@ class Notify < ApplicationMailer include Emails::Groups include Emails::Reviews include Emails::ServiceDesk + include Emails::InProductMarketing helper TimeboxesHelper helper MergeRequestsHelper @@ -32,6 +33,7 @@ class Notify < ApplicationMailer helper AvatarsHelper helper GitlabRoutingHelper helper IssuablesHelper + helper InProductMarketingHelper def test_email(recipient_email, subject, body) mail(to: recipient_email, |