diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 11:10:13 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 11:10:13 +0000 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /app/mailers/emails | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) | |
download | gitlab-ce-0ea3fcec397b69815975647f5e2aa5fe944a8486.tar.gz |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'app/mailers/emails')
-rw-r--r-- | app/mailers/emails/admin_notification.rb | 13 | ||||
-rw-r--r-- | app/mailers/emails/auto_devops.rb | 8 | ||||
-rw-r--r-- | app/mailers/emails/issues.rb | 14 | ||||
-rw-r--r-- | app/mailers/emails/members.rb | 21 | ||||
-rw-r--r-- | app/mailers/emails/merge_requests.rb | 7 | ||||
-rw-r--r-- | app/mailers/emails/pipelines.rb | 8 | ||||
-rw-r--r-- | app/mailers/emails/profile.rb | 17 | ||||
-rw-r--r-- | app/mailers/emails/projects.rb | 8 |
8 files changed, 42 insertions, 54 deletions
diff --git a/app/mailers/emails/admin_notification.rb b/app/mailers/emails/admin_notification.rb index e11f06d8fc9..f44dd448a35 100644 --- a/app/mailers/emails/admin_notification.rb +++ b/app/mailers/emails/admin_notification.rb @@ -15,5 +15,18 @@ module Emails email = user.notification_email_or_default mail to: email, subject: "Unsubscribed from GitLab administrator notifications" end + + def user_auto_banned_email(admin_id, user_id, max_project_downloads:, within_seconds:) + admin = User.find(admin_id) + @user = User.find(user_id) + @max_project_downloads = max_project_downloads + @within_minutes = within_seconds / 60 + + Gitlab::I18n.with_locale(admin.preferred_language) do + email_with_layout( + to: admin.notification_email_or_default, + subject: subject(_("We've detected unusual activity"))) + end + end end end diff --git a/app/mailers/emails/auto_devops.rb b/app/mailers/emails/auto_devops.rb index 9705a3052d4..d10ba40d225 100644 --- a/app/mailers/emails/auto_devops.rb +++ b/app/mailers/emails/auto_devops.rb @@ -8,11 +8,9 @@ module Emails add_project_headers - mail(to: recipient, - subject: auto_devops_disabled_subject(@project.name)) do |format| - format.html { render layout: 'mailer' } - format.text { render layout: 'mailer' } - end + email_with_layout( + to: recipient, + subject: auto_devops_disabled_subject(@project.name)) end private diff --git a/app/mailers/emails/issues.rb b/app/mailers/emails/issues.rb index bbc4be3b324..6a5680c080b 100644 --- a/app/mailers/emails/issues.rb +++ b/app/mailers/emails/issues.rb @@ -94,10 +94,9 @@ module Emails @project = Project.find(project_id) @results = results - mail(to: @user.notification_email_for(@project.group), subject: subject('Imported issues')) do |format| - format.html { render layout: 'mailer' } - format.text { render layout: 'mailer' } - end + email_with_layout( + to: @user.notification_email_for(@project.group), + subject: subject('Imported issues')) end def issues_csv_email(user, project, csv_data, export_status) @@ -110,10 +109,9 @@ module Emails filename = "#{project.full_path.parameterize}_issues_#{Date.today.iso8601}.csv" attachments[filename] = { content: csv_data, mime_type: 'text/csv' } - mail(to: user.notification_email_for(@project.group), subject: subject("Exported issues")) do |format| - format.html { render layout: 'mailer' } - format.text { render layout: 'mailer' } - end + email_with_layout( + to: user.notification_email_for(@project.group), + subject: subject("Exported issues")) end private diff --git a/app/mailers/emails/members.rb b/app/mailers/emails/members.rb index ef2220751bf..c885e41671c 100644 --- a/app/mailers/emails/members.rb +++ b/app/mailers/emails/members.rb @@ -21,7 +21,7 @@ module Emails user = User.find(recipient_id) - member_email_with_layout( + email_with_layout( to: user.notification_email_for(notification_group), subject: subject("Request to join the #{member_source.human_name} #{member_source.model_name.singular}")) end @@ -32,7 +32,7 @@ module Emails return unless member_exists? - member_email_with_layout( + email_with_layout( to: member.user.notification_email_for(notification_group), subject: subject("Access to the #{member_source.human_name} #{member_source.model_name.singular} was granted")) end @@ -47,7 +47,7 @@ module Emails human_name = @source_hidden ? 'Hidden' : member_source.human_name - member_email_with_layout( + email_with_layout( to: user.notification_email_for(notification_group), subject: subject("Access to the #{human_name} #{member_source.model_name.singular} was denied")) end @@ -83,7 +83,7 @@ module Emails subject_line = subjects[reminder_index] % { inviter: member.created_by.name } - member_email_with_layout( + email_with_layout( layout: 'unknown_user_mailer', to: member.invite_email, subject: subject(subject_line) @@ -97,7 +97,7 @@ module Emails return unless member_exists? return unless member.created_by - member_email_with_layout( + email_with_layout( to: member.created_by.notification_email_for(notification_group), subject: subject('Invitation accepted')) end @@ -111,7 +111,7 @@ module Emails user = User.find(created_by_id) - member_email_with_layout( + email_with_layout( to: user.notification_email_for(notification_group), subject: subject('Invitation declined')) end @@ -128,7 +128,7 @@ module Emails _('Group membership expiration date removed') end - member_email_with_layout( + email_with_layout( to: member.user.notification_email_for(notification_group), subject: subject(subject)) end @@ -176,13 +176,6 @@ module Emails def member_source_class @member_source_type.classify.constantize end - - def member_email_with_layout(to:, subject:, layout: 'mailer') - mail(to: to, subject: subject) do |format| - format.html { render layout: layout } - format.text { render layout: layout } - end - end end end diff --git a/app/mailers/emails/merge_requests.rb b/app/mailers/emails/merge_requests.rb index 5cbc3c9ef9c..83d37a365de 100644 --- a/app/mailers/emails/merge_requests.rb +++ b/app/mailers/emails/merge_requests.rb @@ -149,10 +149,9 @@ module Emails filename = "#{project.full_path.parameterize}_merge_requests_#{Date.current.iso8601}.csv" attachments[filename] = { content: csv_data, mime_type: 'text/csv' } - mail(to: user.notification_email_for(@project.group), subject: subject("Exported merge requests")) do |format| - format.html { render layout: 'mailer' } - format.text { render layout: 'mailer' } - end + email_with_layout( + to: user.notification_email_for(@project.group), + subject: subject("Exported merge requests")) end def approved_merge_request_email(recipient_id, merge_request_id, approved_by_user_id, reason = nil) diff --git a/app/mailers/emails/pipelines.rb b/app/mailers/emails/pipelines.rb index 5363ad63771..463f5d3943a 100644 --- a/app/mailers/emails/pipelines.rb +++ b/app/mailers/emails/pipelines.rb @@ -30,11 +30,9 @@ module Emails add_headers - mail(to: recipient, - subject: subject(pipeline_subject(status))) do |format| - format.html { render layout: 'mailer' } - format.text { render layout: 'mailer' } - end + email_with_layout( + to: recipient, + subject: subject(pipeline_subject(status))) end def add_headers diff --git a/app/mailers/emails/profile.rb b/app/mailers/emails/profile.rb index 31fcc7c15cb..81f082b9680 100644 --- a/app/mailers/emails/profile.rb +++ b/app/mailers/emails/profile.rb @@ -13,7 +13,7 @@ module Emails @user = user @recipient = recipient - profile_email_with_layout( + email_with_layout( to: recipient.notification_email_or_default, subject: subject(_("GitLab Account Request"))) end @@ -21,7 +21,7 @@ module Emails def user_admin_rejection_email(name, email) @name = name - profile_email_with_layout( + email_with_layout( to: email, subject: subject(_("GitLab account request rejected"))) end @@ -29,7 +29,7 @@ module Emails def user_deactivated_email(name, email) @name = name - profile_email_with_layout( + email_with_layout( to: email, subject: subject(_('Your account has been deactivated'))) end @@ -125,7 +125,7 @@ module Emails @target_url = edit_profile_password_url Gitlab::I18n.with_locale(@user.preferred_language) do - profile_email_with_layout( + email_with_layout( to: @user.notification_email_or_default, subject: subject(_("%{host} sign-in from new location") % { host: Gitlab.config.gitlab.host })) end @@ -151,15 +151,6 @@ module Emails mail(to: @user.notification_email_or_default, subject: subject(_("New email address added"))) end end - - private - - def profile_email_with_layout(to:, subject:, layout: 'mailer') - mail(to: to, subject: subject) do |format| - format.html { render layout: layout } - format.text { render layout: layout } - end - end end end diff --git a/app/mailers/emails/projects.rb b/app/mailers/emails/projects.rb index efc6ce163c0..ed3fa28b15f 100644 --- a/app/mailers/emails/projects.rb +++ b/app/mailers/emails/projects.rb @@ -75,11 +75,9 @@ module Emails subject_text = "Action required: Project #{project.name} is scheduled to be deleted on " \ "#{deletion_date} due to inactivity" - mail(to: user.notification_email_for(project.group), - subject: subject(subject_text)) do |format| - format.html { render layout: 'mailer' } - format.text { render layout: 'mailer' } - end + email_with_layout( + to: user.notification_email_for(project.group), + subject: subject(subject_text)) end private |