diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-21 02:50:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-21 02:50:22 +0300 |
commit | 9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch) | |
tree | 70467ae3692a0e35e5ea56bcb803eb512a10bedb /app/mailers | |
parent | 4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff) |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'app/mailers')
-rw-r--r-- | app/mailers/emails/in_product_marketing.rb | 7 | ||||
-rw-r--r-- | app/mailers/emails/profile.rb | 24 | ||||
-rw-r--r-- | app/mailers/notify.rb | 4 |
3 files changed, 31 insertions, 4 deletions
diff --git a/app/mailers/emails/in_product_marketing.rb b/app/mailers/emails/in_product_marketing.rb index 0be9ec5f915..d21c3d13b10 100644 --- a/app/mailers/emails/in_product_marketing.rb +++ b/app/mailers/emails/in_product_marketing.rb @@ -4,8 +4,10 @@ module Emails module InProductMarketing include InProductMarketingHelper - FROM_ADDRESS = 'GitLab <team@gitlab.com>'.freeze + 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', @@ -25,7 +27,8 @@ module Emails private def mail_to(to:, subject:) - mail(to: to, subject: subject, from: FROM_ADDRESS, reply_to: FROM_ADDRESS, **CUSTOM_HEADERS) do |format| + 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 } end diff --git a/app/mailers/emails/profile.rb b/app/mailers/emails/profile.rb index f13ba9caee0..f967323f849 100644 --- a/app/mailers/emails/profile.rb +++ b/app/mailers/emails/profile.rb @@ -74,6 +74,30 @@ module Emails end end + def ssh_key_expired_email(user, fingerprints) + return unless user&.active? + + @user = user + @fingerprints = fingerprints + @target_url = profile_keys_url + + Gitlab::I18n.with_locale(@user.preferred_language) do + mail(to: @user.notification_email, subject: subject(_("Your SSH key has expired"))) + end + end + + def ssh_key_expiring_soon_email(user, fingerprints) + return unless user&.active? + + @user = user + @fingerprints = fingerprints + @target_url = profile_keys_url + + Gitlab::I18n.with_locale(@user.preferred_language) do + mail(to: @user.notification_email, subject: subject(_("Your SSH key is expiring soon."))) + end + end + def unknown_sign_in_email(user, ip, time) @user = user @ip = ip diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index 8f947ea7113..5f5afef350b 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -70,7 +70,7 @@ class Notify < ApplicationMailer return unless sender = User.find(sender_id) address = default_sender_address - address.display_name = sender_name.presence || sender.name + address.display_name = sender_name.presence || "#{sender.name} (#{sender.to_reference})" if send_from_user_email && can_send_from_user_email?(sender) address.address = sender.email @@ -178,7 +178,7 @@ class Notify < ApplicationMailer headers['In-Reply-To'] = message_id(note.references.last) headers['References'] = note.references.map { |ref| message_id(ref) } - headers['X-GitLab-Discussion-ID'] = note.discussion.id if note.part_of_discussion? + headers['X-GitLab-Discussion-ID'] = note.discussion.id if note.part_of_discussion? || note.can_be_discussion_note? headers[:subject] = "Re: #{headers[:subject]}" if headers[:subject] |