diff options
Diffstat (limited to 'app/mailers')
-rw-r--r-- | app/mailers/emails/admin_notification.rb | 7 | ||||
-rw-r--r-- | app/mailers/emails/identity_verification.rb | 15 | ||||
-rw-r--r-- | app/mailers/emails/merge_requests.rb | 6 | ||||
-rw-r--r-- | app/mailers/notify.rb | 1 | ||||
-rw-r--r-- | app/mailers/previews/notify_preview.rb | 14 |
5 files changed, 38 insertions, 5 deletions
diff --git a/app/mailers/emails/admin_notification.rb b/app/mailers/emails/admin_notification.rb index f44dd448a35..9d02d4132a1 100644 --- a/app/mailers/emails/admin_notification.rb +++ b/app/mailers/emails/admin_notification.rb @@ -16,11 +16,16 @@ module Emails mail to: email, subject: "Unsubscribed from GitLab administrator notifications" end - def user_auto_banned_email(admin_id, user_id, max_project_downloads:, within_seconds:) + def user_auto_banned_email(admin_id, user_id, max_project_downloads:, within_seconds:, group: nil) admin = User.find(admin_id) @user = User.find(user_id) @max_project_downloads = max_project_downloads @within_minutes = within_seconds / 60 + @ban_scope = if group.present? + _('your group (%{group_name})' % { group_name: group.name }) + else + _('your GitLab instance') + end Gitlab::I18n.with_locale(admin.preferred_language) do email_with_layout( diff --git a/app/mailers/emails/identity_verification.rb b/app/mailers/emails/identity_verification.rb new file mode 100644 index 00000000000..2fc8cae06fe --- /dev/null +++ b/app/mailers/emails/identity_verification.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Emails + module IdentityVerification + def verification_instructions_email(user_id, token:, expires_in:) + @token = token + @expires_in_minutes = expires_in + @password_link = edit_profile_password_url + @two_fa_link = help_page_url('user/profile/account/two_factor_authentication') + + user = User.find(user_id) + email_with_layout(to: user.email, subject: s_('IdentityVerification|Verify your identity')) + end + end +end diff --git a/app/mailers/emails/merge_requests.rb b/app/mailers/emails/merge_requests.rb index 83d37a365de..6a2b447f4a0 100644 --- a/app/mailers/emails/merge_requests.rb +++ b/app/mailers/emails/merge_requests.rb @@ -15,15 +15,15 @@ module Emails end # existing_commits - an array containing the first and last commits - def push_to_merge_request_email(recipient_id, merge_request_id, updated_by_user_id, reason = nil, new_commits: [], total_new_commits_count: nil, existing_commits: [], total_existing_commits_count: nil) + def push_to_merge_request_email(recipient_id, merge_request_id, updated_by_user_id, reason = nil, new_commits:, total_new_commits_count:, existing_commits:, total_existing_commits_count:) setup_merge_request_mail(merge_request_id, recipient_id) @new_commits = new_commits - @total_new_commits_count = total_new_commits_count || @new_commits.length + @total_new_commits_count = total_new_commits_count @total_stripped_new_commits_count = @total_new_commits_count - @new_commits.length @existing_commits = existing_commits - @total_existing_commits_count = total_existing_commits_count || @existing_commits.length + @total_existing_commits_count = total_existing_commits_count @updated_by_user = User.find(updated_by_user_id) diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index b70ce1d3655..ed7681e595f 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -23,6 +23,7 @@ class Notify < ApplicationMailer include Emails::ServiceDesk include Emails::InProductMarketing include Emails::AdminNotification + include Emails::IdentityVerification helper TimeboxesHelper helper MergeRequestsHelper diff --git a/app/mailers/previews/notify_preview.rb b/app/mailers/previews/notify_preview.rb index 61456ef79c8..be8d96012cc 100644 --- a/app/mailers/previews/notify_preview.rb +++ b/app/mailers/previews/notify_preview.rb @@ -205,10 +205,18 @@ class NotifyPreview < ActionMailer::Preview Notify.inactive_project_deletion_warning_email(project, user, '2022-04-22').message end - def user_auto_banned_email + def user_auto_banned_instance_email ::Notify.user_auto_banned_email(user.id, user.id, max_project_downloads: 5, within_seconds: 600).message end + def user_auto_banned_namespace_email + ::Notify.user_auto_banned_email(user.id, user.id, max_project_downloads: 5, within_seconds: 600, group: group).message + end + + def verification_instructions_email + Notify.verification_instructions_email(user.id, token: '123456', expires_in: 60).message + end + private def project @@ -239,6 +247,10 @@ class NotifyPreview < ActionMailer::Preview @user ||= User.last end + def group + @group ||= Group.last + end + def member @member ||= Member.last end |