Commit 625244bd authored by Rémy Coutable's avatar Rémy Coutable

Move all the prepend in mailers to bottom

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 14e17bc0
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
module Emails module Emails
module MergeRequests module MergeRequests
prepend Emails::EE::MergeRequests # rubocop: disable Cop/InjectEnterpriseEditionModule
def new_merge_request_email(recipient_id, merge_request_id, reason = nil) def new_merge_request_email(recipient_id, merge_request_id, reason = nil)
setup_merge_request_mail(merge_request_id, recipient_id, present: true) setup_merge_request_mail(merge_request_id, recipient_id, present: true)
...@@ -115,3 +113,5 @@ module Emails ...@@ -115,3 +113,5 @@ module Emails
end end
end end
end end
Emails::MergeRequests.prepend(EE::Emails::MergeRequests)
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
module Emails module Emails
module Notes module Notes
prepend Emails::EE::Notes # rubocop: disable Cop/InjectEnterpriseEditionModule
def note_commit_email(recipient_id, note_id) def note_commit_email(recipient_id, note_id)
setup_note_mail(note_id, recipient_id) setup_note_mail(note_id, recipient_id)
...@@ -70,3 +68,5 @@ module Emails ...@@ -70,3 +68,5 @@ module Emails
end end
end end
end end
Emails::Notes.prepend(EE::Emails::Notes)
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
module Emails module Emails
module Projects module Projects
prepend Emails::EE::Projects # rubocop: disable Cop/InjectEnterpriseEditionModule
def project_was_moved_email(project_id, user_id, old_path_with_namespace) def project_was_moved_email(project_id, user_id, old_path_with_namespace)
@current_user = @user = User.find user_id @current_user = @user = User.find user_id
@project = Project.find project_id @project = Project.find project_id
...@@ -59,3 +57,5 @@ module Emails ...@@ -59,3 +57,5 @@ module Emails
end end
end end
end end
Emails::Projects.prepend(EE::Emails::Projects)
# frozen_string_literal: true # frozen_string_literal: true
class Notify < BaseMailer class Notify < BaseMailer
prepend ::EE::Notify # rubocop: disable Cop/InjectEnterpriseEditionModule
include ActionDispatch::Routing::PolymorphicRoutes include ActionDispatch::Routing::PolymorphicRoutes
include GitlabRoutingHelper include GitlabRoutingHelper
include EmailsHelper include EmailsHelper
...@@ -212,3 +210,5 @@ class Notify < BaseMailer ...@@ -212,3 +210,5 @@ class Notify < BaseMailer
@unsubscribe_url = unsubscribe_sent_notification_url(@sent_notification) @unsubscribe_url = unsubscribe_sent_notification_url(@sent_notification)
end end
end end
Notify.prepend(EE::Notify)
# frozen_string_literal: true # frozen_string_literal: true
module Emails module EE
module EE module Emails
module MergeRequests module MergeRequests
def add_merge_request_approver_email(recipient_id, merge_request_id, updated_by_user_id, reason = nil) def add_merge_request_approver_email(recipient_id, merge_request_id, updated_by_user_id, reason = nil)
setup_merge_request_mail(merge_request_id, recipient_id, present: true) setup_merge_request_mail(merge_request_id, recipient_id, present: true)
@updated_by = User.find(updated_by_user_id) @updated_by = ::User.find(updated_by_user_id)
mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason)) mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason))
end end
def approved_merge_request_email(recipient_id, merge_request_id, approved_by_user_id, reason = nil) def approved_merge_request_email(recipient_id, merge_request_id, approved_by_user_id, reason = nil)
setup_merge_request_mail(merge_request_id, recipient_id) setup_merge_request_mail(merge_request_id, recipient_id)
@approved_by = User.find(approved_by_user_id) @approved_by = ::User.find(approved_by_user_id)
mail_answer_thread(@merge_request, merge_request_thread_options(approved_by_user_id, recipient_id, reason)) mail_answer_thread(@merge_request, merge_request_thread_options(approved_by_user_id, recipient_id, reason))
end end
def unapproved_merge_request_email(recipient_id, merge_request_id, unapproved_by_user_id, reason = nil) def unapproved_merge_request_email(recipient_id, merge_request_id, unapproved_by_user_id, reason = nil)
setup_merge_request_mail(merge_request_id, recipient_id) setup_merge_request_mail(merge_request_id, recipient_id)
@unapproved_by = User.find(unapproved_by_user_id) @unapproved_by = ::User.find(unapproved_by_user_id)
mail_answer_thread(@merge_request, merge_request_thread_options(unapproved_by_user_id, recipient_id, reason)) mail_answer_thread(@merge_request, merge_request_thread_options(unapproved_by_user_id, recipient_id, reason))
end end
end end
......
# frozen_string_literal: true # frozen_string_literal: true
module Emails module EE
module EE module Emails
module Notes module Notes
extend ::Gitlab::Utils::Override
def note_epic_email(recipient_id, note_id) def note_epic_email(recipient_id, note_id)
setup_note_mail(note_id, recipient_id) setup_note_mail(note_id, recipient_id)
......
# frozen_string_literal: true # frozen_string_literal: true
module Emails module EE
module EE module Emails
module Projects module Projects
def mirror_was_hard_failed_email(project_id, user_id) def mirror_was_hard_failed_email(project_id, user_id)
@project = Project.find(project_id) @project = ::Project.find(project_id)
user = User.find(user_id) user = ::User.find(user_id)
mail(to: user.notification_email, mail(to: user.notification_email,
subject: subject('Repository mirroring paused')) subject: subject('Repository mirroring paused'))
end end
def project_mirror_user_changed_email(new_mirror_user_id, deleted_user_name, project_id) def project_mirror_user_changed_email(new_mirror_user_id, deleted_user_name, project_id)
@project = Project.find(project_id) @project = ::Project.find(project_id)
@deleted_user_name = deleted_user_name @deleted_user_name = deleted_user_name
new_mirror_user = User.find(new_mirror_user_id) new_mirror_user = ::User.find(new_mirror_user_id)
mail(to: new_mirror_user.notification_email, mail(to: new_mirror_user.notification_email,
subject: subject('Mirror user changed')) subject: subject('Mirror user changed'))
...@@ -24,7 +24,7 @@ module Emails ...@@ -24,7 +24,7 @@ module Emails
def prometheus_alert_fired_email(project_id, user_id, alert_params) def prometheus_alert_fired_email(project_id, user_id, alert_params)
alert_metric_id = alert_params["labels"]["gitlab_alert_id"] alert_metric_id = alert_params["labels"]["gitlab_alert_id"]
@project = Project.find_by(id: project_id) @project = ::Project.find_by(id: project_id)
return unless @project return unless @project
@alert = @project.prometheus_alerts.find_by(prometheus_metric: alert_metric_id) @alert = @project.prometheus_alerts.find_by(prometheus_metric: alert_metric_id)
...@@ -32,7 +32,7 @@ module Emails ...@@ -32,7 +32,7 @@ module Emails
@environment = @alert.environment @environment = @alert.environment
user = User.find_by(id: user_id) user = ::User.find_by(id: user_id)
return unless user return unless user
subject_text = "Alert: #{@environment.name} - #{@alert.title} #{@alert.computed_operator} #{@alert.threshold} for 5 minutes" subject_text = "Alert: #{@environment.name} - #{@alert.title} #{@alert.computed_operator} #{@alert.threshold} for 5 minutes"
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
require 'email_spec' require 'email_spec'
describe Emails::EE::MergeRequests do describe EE::Emails::MergeRequests do
include EmailSpec::Matchers include EmailSpec::Matchers
let(:user) { create(:user) } let(:user) { create(:user) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment