From e8d2c2579383897a1dd7f9debd359abe8ae8373d Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 20 Jul 2021 09:55:51 +0000 Subject: Add latest changes from gitlab-org/gitlab@14-1-stable-ee --- app/mailers/emails/admin_notification.rb | 19 +++++++++++++++++++ app/mailers/emails/profile.rb | 8 ++++++++ app/mailers/emails/service_desk.rb | 8 ++------ app/mailers/notify.rb | 1 + 4 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 app/mailers/emails/admin_notification.rb (limited to 'app/mailers') diff --git a/app/mailers/emails/admin_notification.rb b/app/mailers/emails/admin_notification.rb new file mode 100644 index 00000000000..f4540ef81a5 --- /dev/null +++ b/app/mailers/emails/admin_notification.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Emails + module AdminNotification + def send_admin_notification(user_id, subject, body) + user = User.find(user_id) + email = user.notification_email + @unsubscribe_url = unsubscribe_url(email: Base64.urlsafe_encode64(email)) + @body = body + mail to: email, subject: subject + end + + def send_unsubscribed_notification(user_id) + user = User.find(user_id) + email = user.notification_email + mail to: email, subject: "Unsubscribed from GitLab administrator notifications" + end + end +end diff --git a/app/mailers/emails/profile.rb b/app/mailers/emails/profile.rb index 2efcba54c13..a8affb34f62 100644 --- a/app/mailers/emails/profile.rb +++ b/app/mailers/emails/profile.rb @@ -26,6 +26,14 @@ module Emails subject: subject(_("GitLab account request rejected"))) end + def user_deactivated_email(name, email) + @name = name + + profile_email_with_layout( + to: email, + subject: subject(_('Your account has been deactivated'))) + end + # rubocop: disable CodeReuse/ActiveRecord def new_ssh_key_email(key_id) @key = Key.find_by(id: key_id) diff --git a/app/mailers/emails/service_desk.rb b/app/mailers/emails/service_desk.rb index e8034ef9b57..66eb2c646a9 100644 --- a/app/mailers/emails/service_desk.rb +++ b/app/mailers/emails/service_desk.rb @@ -20,9 +20,7 @@ module Emails options = service_desk_options(email_sender, 'thank_you', @issue.external_author) .merge(subject: "Re: #{subject_base}") - mail_new_thread(@issue, options).tap do - Gitlab::Metrics::BackgroundTransaction.current&.add_event(:service_desk_thank_you_email) - end + mail_new_thread(@issue, options) end def service_desk_new_note_email(issue_id, note_id, recipient) @@ -33,9 +31,7 @@ module Emails options = service_desk_options(email_sender, 'new_note', recipient) .merge(subject: subject_base) - mail_answer_thread(@issue, options).tap do - Gitlab::Metrics::BackgroundTransaction.current&.add_event(:service_desk_new_note_email) - end + mail_answer_thread(@issue, options) end private diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index dd75ab4bf03..03b70fffde1 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -22,6 +22,7 @@ class Notify < ApplicationMailer include Emails::Reviews include Emails::ServiceDesk include Emails::InProductMarketing + include Emails::AdminNotification helper TimeboxesHelper helper MergeRequestsHelper -- cgit v1.2.3