diff options
Diffstat (limited to 'app/mailers')
-rw-r--r-- | app/mailers/emails/issues.rb | 2 | ||||
-rw-r--r-- | app/mailers/emails/profile.rb | 11 | ||||
-rw-r--r-- | app/mailers/emails/reviews.rb | 33 | ||||
-rw-r--r-- | app/mailers/notify.rb | 3 | ||||
-rw-r--r-- | app/mailers/previews/notify_preview.rb | 2 |
5 files changed, 47 insertions, 4 deletions
diff --git a/app/mailers/emails/issues.rb b/app/mailers/emails/issues.rb index d4d93ab9795..bcf60bea0e0 100644 --- a/app/mailers/emails/issues.rb +++ b/app/mailers/emails/issues.rb @@ -126,3 +126,5 @@ module Emails end end end + +Emails::Issues.prepend_if_ee('EE::Emails::Issues') diff --git a/app/mailers/emails/profile.rb b/app/mailers/emails/profile.rb index 4b19149a833..c327a0bab43 100644 --- a/app/mailers/emails/profile.rb +++ b/app/mailers/emails/profile.rb @@ -45,13 +45,20 @@ module Emails end end - def unknown_sign_in_email(user, ip) + def unknown_sign_in_email(user, ip, time) @user = user @ip = ip + @time = time @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"))) + mail( + to: @user.notification_email, + subject: subject(_("%{host} sign-in from new location") % { host: Gitlab.config.gitlab.host }) + ) do |format| + format.html { render layout: 'mailer' } + format.text { render layout: 'mailer' } + end end end end diff --git a/app/mailers/emails/reviews.rb b/app/mailers/emails/reviews.rb new file mode 100644 index 00000000000..ddb9e161a80 --- /dev/null +++ b/app/mailers/emails/reviews.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module Emails + module Reviews + def new_review_email(recipient_id, review_id) + setup_review_email(review_id, recipient_id) + + mail_answer_thread(@merge_request, review_thread_options(recipient_id)) + end + + private + + def review_thread_options(recipient_id) + { + from: sender(@author.id), + to: User.find(recipient_id).notification_email_for(@merge_request.target_project.group), + subject: subject("#{@merge_request.title} (#{@merge_request.to_reference})") + } + end + + def setup_review_email(review_id, recipient_id) + review = Review.find_by_id(review_id) + + @notes = review.notes + @author = review.author + @author_name = review.author_name + @project = review.project + @merge_request = review.merge_request + @target_url = project_merge_request_url(@project, @merge_request) + @sent_notification = SentNotification.record(@merge_request, recipient_id, reply_key) + end + end +end diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index d9483bab543..2cf72d40635 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -18,8 +18,9 @@ class Notify < ApplicationMailer include Emails::RemoteMirrors include Emails::Releases include Emails::Groups + include Emails::Reviews - helper MilestonesHelper + helper TimeboxesHelper helper MergeRequestsHelper helper DiffHelper helper BlobHelper diff --git a/app/mailers/previews/notify_preview.rb b/app/mailers/previews/notify_preview.rb index c931b5a848f..cb7c6a36c27 100644 --- a/app/mailers/previews/notify_preview.rb +++ b/app/mailers/previews/notify_preview.rb @@ -162,7 +162,7 @@ class NotifyPreview < ActionMailer::Preview end def unknown_sign_in_email - Notify.unknown_sign_in_email(user, '127.0.0.1').message + Notify.unknown_sign_in_email(user, '127.0.0.1', Time.current).message end private |