diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-01 15:08:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-01 15:08:08 +0300 |
commit | 2828f81d2a41f46b89e13dc057b982f27aeee547 (patch) | |
tree | 742120cc334d018efe38a3974fd59a67869acc6d /app/mailers | |
parent | 4def415fbf45e0693b17ea418d378d62ab03a146 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/mailers')
-rw-r--r-- | app/mailers/emails/admin_notification.rb | 7 | ||||
-rw-r--r-- | app/mailers/previews/notify_preview.rb | 10 |
2 files changed, 15 insertions, 2 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/previews/notify_preview.rb b/app/mailers/previews/notify_preview.rb index 61456ef79c8..074aec54b10 100644 --- a/app/mailers/previews/notify_preview.rb +++ b/app/mailers/previews/notify_preview.rb @@ -205,10 +205,14 @@ 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 + private def project @@ -239,6 +243,10 @@ class NotifyPreview < ActionMailer::Preview @user ||= User.last end + def group + @group ||= Group.last + end + def member @member ||= Member.last end |