diff options
author | Nick Thomas <nick@gitlab.com> | 2018-12-12 13:31:53 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-12-12 13:31:53 +0000 |
commit | b9ccf013bab3f7ec25b70d83f37b1b0923302379 (patch) | |
tree | 90674592fccdb3c2b8bec338f97583cfd17854f7 /app/mailers | |
parent | 5ee900ee9d2288cbf57007d905acd2a6e9239ff4 (diff) | |
parent | b65cb237cee0b1a8dfdc21a09f2b181d0edf5bde (diff) | |
download | gitlab-ce-b9ccf013bab3f7ec25b70d83f37b1b0923302379.tar.gz |
Merge branch '54650-send-an-email-to-project-owners-when-a-mirror-update-fails' into 'master'
Send a notification email on mirror update errors
Closes #54650
See merge request gitlab-org/gitlab-ce!23595
Diffstat (limited to 'app/mailers')
-rw-r--r-- | app/mailers/emails/remote_mirrors.rb | 12 | ||||
-rw-r--r-- | app/mailers/notify.rb | 1 | ||||
-rw-r--r-- | app/mailers/previews/notify_preview.rb | 8 |
3 files changed, 21 insertions, 0 deletions
diff --git a/app/mailers/emails/remote_mirrors.rb b/app/mailers/emails/remote_mirrors.rb new file mode 100644 index 00000000000..2018eb7260b --- /dev/null +++ b/app/mailers/emails/remote_mirrors.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Emails + module RemoteMirrors + def remote_mirror_update_failed_email(remote_mirror_id, recipient_id) + @remote_mirror = RemoteMirrorFinder.new(id: remote_mirror_id).execute + @project = @remote_mirror.project + + mail(to: recipient(recipient_id), subject: subject('Remote mirror update failed')) + end + end +end diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index 6d86b60c50c..49a3920e43f 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -13,6 +13,7 @@ class Notify < BaseMailer include Emails::Pipelines include Emails::Members include Emails::AutoDevops + include Emails::RemoteMirrors helper MergeRequestsHelper helper DiffHelper diff --git a/app/mailers/previews/notify_preview.rb b/app/mailers/previews/notify_preview.rb index e7e8d96eca4..2ac4610967d 100644 --- a/app/mailers/previews/notify_preview.rb +++ b/app/mailers/previews/notify_preview.rb @@ -145,6 +145,10 @@ class NotifyPreview < ActionMailer::Preview Notify.autodevops_disabled_email(pipeline, user.email).message end + def remote_mirror_update_failed_email + Notify.remote_mirror_update_failed_email(remote_mirror.id, user.id).message + end + private def project @@ -167,6 +171,10 @@ class NotifyPreview < ActionMailer::Preview @pipeline = Ci::Pipeline.last end + def remote_mirror + @remote_mirror ||= RemoteMirror.last + end + def user @user ||= User.last end |