diff options
Diffstat (limited to 'app/mailers')
-rw-r--r-- | app/mailers/emails/in_product_marketing.rb | 42 | ||||
-rw-r--r-- | app/mailers/emails/profile.rb | 18 | ||||
-rw-r--r-- | app/mailers/notify.rb | 1 | ||||
-rw-r--r-- | app/mailers/previews/notify_preview.rb | 8 |
4 files changed, 18 insertions, 51 deletions
diff --git a/app/mailers/emails/in_product_marketing.rb b/app/mailers/emails/in_product_marketing.rb deleted file mode 100644 index 92743dc1926..00000000000 --- a/app/mailers/emails/in_product_marketing.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -module Emails - module InProductMarketing - FROM_ADDRESS = 'GitLab <team@gitlab.com>' - CUSTOM_HEADERS = { - from: FROM_ADDRESS, - reply_to: FROM_ADDRESS, - 'X-Mailgun-Track' => 'yes', - 'X-Mailgun-Track-Clicks' => 'yes', - 'X-Mailgun-Track-Opens' => 'yes', - 'X-Mailgun-Tag' => 'marketing' - }.freeze - - def build_ios_app_guide_email(recipient_email) - @message = ::Gitlab::Email::Message::BuildIosAppGuide.new - - mail_to(to: recipient_email, subject: @message.subject_line) - end - - private - - def mail_to(to:, subject:) - custom_headers = Gitlab.com? ? CUSTOM_HEADERS : {} - mail_with_locale(to: to, subject: subject, **custom_headers) do |format| - format.html do - @message.format = :html - - render layout: 'in_product_marketing_mailer' - end - - format.text do - @message.format = :text - - render layout: nil - end - end - end - end -end - -Emails::InProductMarketing.prepend_mod diff --git a/app/mailers/emails/profile.rb b/app/mailers/emails/profile.rb index a9e1efbdd5d..2be4cdf734a 100644 --- a/app/mailers/emails/profile.rb +++ b/app/mailers/emails/profile.rb @@ -65,11 +65,13 @@ module Emails @token_names = token_names @days_to_expire = PersonalAccessToken::DAYS_TO_EXPIRE @resource = resource - @target_url = if resource.is_a?(Group) - group_settings_access_tokens_url(resource) - else - project_settings_access_tokens_url(resource) - end + if resource.is_a?(Group) + @target_url = group_settings_access_tokens_url(resource) + @reason_text = _('You are receiving this email because you are an Owner of the Group.') + else + @target_url = project_settings_access_tokens_url(resource) + @reason_text = _('You are receiving this email because you are a Maintainer of the Project.') + end mail_with_locale( to: recipient.notification_email_or_default, @@ -100,7 +102,7 @@ module Emails @target_url = profile_personal_access_tokens_url @days_to_expire = PersonalAccessToken::DAYS_TO_EXPIRE - mail_with_locale(to: @user.notification_email_or_default, subject: subject(_("Your personal access tokens will expire in %{days_to_expire} days or less") % { days_to_expire: @days_to_expire })) + email_with_layout(to: @user.notification_email_or_default, subject: subject(_("Your personal access tokens will expire in %{days_to_expire} days or less") % { days_to_expire: @days_to_expire })) end def access_token_expired_email(user, token_names = []) @@ -121,7 +123,7 @@ module Emails @target_url = profile_personal_access_tokens_url @source = source - mail_with_locale(to: @user.notification_email_or_default, subject: subject(_("A personal access token has been revoked"))) + email_with_layout(to: @user.notification_email_or_default, subject: subject(_("Your personal access token has been revoked"))) end def ssh_key_expired_email(user, fingerprints) @@ -170,7 +172,7 @@ module Emails @user = user - mail_with_locale(to: @user.notification_email_or_default, subject: subject(_("Two-factor authentication disabled"))) + email_with_layout(to: @user.notification_email_or_default, subject: subject(_("Two-factor authentication disabled"))) end def new_email_address_added_email(user, email) diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index 77d32a55941..2f90579a5c2 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -22,7 +22,6 @@ class Notify < ApplicationMailer include Emails::Groups include Emails::Reviews include Emails::ServiceDesk - include Emails::InProductMarketing include Emails::AdminNotification include Emails::IdentityVerification include Emails::Imports diff --git a/app/mailers/previews/notify_preview.rb b/app/mailers/previews/notify_preview.rb index 638df56b770..6548b6d1088 100644 --- a/app/mailers/previews/notify_preview.rb +++ b/app/mailers/previews/notify_preview.rb @@ -81,6 +81,10 @@ class NotifyPreview < ActionMailer::Preview Notify.access_token_revoked_email(user, 'token_name').message end + def access_token_about_to_expire_email + Notify.access_token_about_to_expire_email(user, ['%w', '%w']).message + end + def ssh_key_expired_email fingerprints = [] Notify.ssh_key_expired_email(user, fingerprints).message @@ -222,6 +226,10 @@ class NotifyPreview < ActionMailer::Preview Notify.two_factor_otp_attempt_failed_email(user, '127.0.0.1').message end + def disabled_two_factor_email + Notify.disabled_two_factor_email(user).message + end + def new_email_address_added_email Notify.new_email_address_added_email(user, 'someone@gitlab.com').message end |