Commit c9a17420 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch '5851-extract-ee-specific-files-lines-for-app-mailers-emails' into 'master'

Resolve "Extract EE specific files/lines for app/mailers/emails"

Closes #5851

See merge request gitlab-org/gitlab-ee!8050
parents dbe79c49 4c2cd506
......@@ -2,6 +2,8 @@
module Emails
module MergeRequests
prepend Emails::EE::MergeRequests
def new_merge_request_email(recipient_id, merge_request_id, reason = nil)
setup_merge_request_mail(merge_request_id, recipient_id, present: true)
......@@ -67,27 +69,6 @@ module Emails
mail_answer_thread(@merge_request, merge_request_thread_options(@merge_request.author_id, recipient_id, reason))
end
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)
@updated_by = User.find(updated_by_user_id)
mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason))
end
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)
@approved_by = User.find(approved_by_user_id)
mail_answer_thread(@merge_request, merge_request_thread_options(approved_by_user_id, recipient_id, reason))
end
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)
@unapproved_by = User.find(unapproved_by_user_id)
mail_answer_thread(@merge_request, merge_request_thread_options(unapproved_by_user_id, recipient_id, reason))
end
def resolved_all_discussions_email(recipient_id, merge_request_id, resolved_by_user_id, reason = nil)
setup_merge_request_mail(merge_request_id, recipient_id)
......
# frozen_string_literal: true
module Emails
module EE
module MergeRequests
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)
@updated_by = User.find(updated_by_user_id)
mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason))
end
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)
@approved_by = User.find(approved_by_user_id)
mail_answer_thread(@merge_request, merge_request_thread_options(approved_by_user_id, recipient_id, reason))
end
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)
@unapproved_by = User.find(unapproved_by_user_id)
mail_answer_thread(@merge_request, merge_request_thread_options(unapproved_by_user_id, recipient_id, reason))
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
require 'email_spec'
describe Emails::EE::MergeRequests do
include EmailSpec::Matchers
let(:user) { create(:user) }
let(:merge_request) { create(:merge_request) }
let(:current_user) { create(:user) }
describe '#add_merge_request_approver_email' do
subject { Notify.add_merge_request_approver_email(user.id, merge_request.id, current_user.id) }
context 'when email_author_in_body is set' do
it 'includes the name of the person who added the approver' do
stub_application_setting(email_author_in_body: true)
expect(subject).to have_body_text(current_user.name)
end
end
context 'when email_author_in_body is not set' do
it 'does not include the name of the person who added the approver' do
stub_application_setting(email_author_in_body: false)
expect(subject).not_to have_body_text(current_user.name)
end
end
end
describe '#approved_merge_request_email' do
subject { Notify.approved_merge_request_email(user.id, merge_request.id, current_user.id) }
it 'includes the name of the approver' do
expect(subject).to have_body_text(current_user.name)
end
end
describe '#unapproved_merge_request_email' do
subject { Notify.unapproved_merge_request_email(user.id, merge_request.id, current_user.id) }
it 'includes the name of the person who removed their approval' do
expect(subject).to have_body_text(current_user.name)
end
end
end
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