From 9f46488805e86b1bc341ea1620b866016c2ce5ed Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 20 May 2020 14:34:42 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-0-stable-ee --- app/mailers/emails/groups.rb | 19 +++++++++++++++++++ app/mailers/emails/notes.rb | 12 ++++++++++++ app/mailers/emails/profile.rb | 10 ++++++++++ app/mailers/notify.rb | 1 + app/mailers/previews/notify_preview.rb | 4 ++++ 5 files changed, 46 insertions(+) create mode 100644 app/mailers/emails/groups.rb (limited to 'app/mailers') diff --git a/app/mailers/emails/groups.rb b/app/mailers/emails/groups.rb new file mode 100644 index 00000000000..07812a01202 --- /dev/null +++ b/app/mailers/emails/groups.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Emails + module Groups + def group_was_exported_email(current_user, group) + group_email(current_user, group, _('Group was exported')) + end + + def group_was_not_exported_email(current_user, group, errors) + group_email(current_user, group, _('Group export error'), errors: errors) + end + + def group_email(current_user, group, subj, errors: nil) + @group = group + @errors = errors + mail(to: current_user.notification_email_for(@group), subject: subject(subj)) + end + end +end diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb index 6dd4ccb510a..4b56ff60f09 100644 --- a/app/mailers/emails/notes.rb +++ b/app/mailers/emails/notes.rb @@ -40,6 +40,18 @@ module Emails mail_answer_note_thread(@snippet, @note, note_thread_options(recipient_id, reason)) end + def note_design_email(recipient_id, note_id, reason = nil) + setup_note_mail(note_id, recipient_id) + + design = @note.noteable + @target_url = ::Gitlab::Routing.url_helpers.designs_project_issue_url( + @note.resource_parent, + design.issue, + note_target_url_query_params.merge(vueroute: design.filename) + ) + mail_answer_note_thread(design, @note, note_thread_options(recipient_id, reason)) + end + private def note_target_url_options diff --git a/app/mailers/emails/profile.rb b/app/mailers/emails/profile.rb index 441439444d5..4b19149a833 100644 --- a/app/mailers/emails/profile.rb +++ b/app/mailers/emails/profile.rb @@ -44,6 +44,16 @@ module Emails mail(to: @user.notification_email, subject: subject(_("Your Personal Access Tokens will expire in %{days_to_expire} days or less") % { days_to_expire: @days_to_expire })) end end + + def unknown_sign_in_email(user, ip) + @user = user + @ip = ip + @target_url = edit_profile_password_url + + Gitlab::I18n.with_locale(@user.preferred_language) do + mail(to: @user.notification_email, subject: subject(_("Unknown sign-in from new location"))) + end + end end end diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index 49eacc44519..d9483bab543 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -17,6 +17,7 @@ class Notify < ApplicationMailer include Emails::AutoDevops include Emails::RemoteMirrors include Emails::Releases + include Emails::Groups helper MilestonesHelper helper MergeRequestsHelper diff --git a/app/mailers/previews/notify_preview.rb b/app/mailers/previews/notify_preview.rb index 38e1d9532a6..c931b5a848f 100644 --- a/app/mailers/previews/notify_preview.rb +++ b/app/mailers/previews/notify_preview.rb @@ -161,6 +161,10 @@ class NotifyPreview < ActionMailer::Preview Notify.remote_mirror_update_failed_email(remote_mirror.id, user.id).message end + def unknown_sign_in_email + Notify.unknown_sign_in_email(user, '127.0.0.1').message + end + private def project -- cgit v1.2.3