Commit 8018134c authored by David Kim's avatar David Kim Committed by Bob Van Landuyt

Add reviewers detail to merge request status email

parent c19699f1
......@@ -89,7 +89,7 @@ class NotifyPreview < ActionMailer::Preview
end
def merge_request_status_email
Notify.merge_request_status_email(user.id, merge_request.id, 'closed', user.id).message
Notify.merge_request_status_email(user.id, merge_request.id, 'reopened', user.id).message
end
def merged_merge_request_email
......
......@@ -6,3 +6,4 @@ Merge Request URL: #{project_merge_request_url(@merge_request.target_project, @m
Author: #{sanitize_name(@merge_request.author_name)}
= assignees_label(@merge_request)
= reviewers_label(@merge_request)
---
title: Add reviewers detail to merge request status email
merge_request: 55584
author:
type: added
......@@ -90,6 +90,40 @@ RSpec.describe Emails::MergeRequests do
end
end
describe '#merge_request_status_email' do
let(:status) { 'reopened' }
subject { Notify.merge_request_status_email(recipient.id, merge_request.id, status, current_user.id) }
it_behaves_like 'an answer to an existing thread with reply-by-email enabled' do
let(:model) { merge_request }
end
it_behaves_like 'it should show Gmail Actions View Merge request link'
it_behaves_like 'an unsubscribeable thread'
it_behaves_like 'appearance header and footer enabled'
it_behaves_like 'appearance header and footer not enabled'
it 'is sent as the author' do
sender = subject.header[:from].addrs[0]
expect(sender.display_name).to eq(current_user.name)
expect(sender.address).to eq(gitlab_sender)
end
it 'has the correct subject and body' do
aggregate_failures do
is_expected.to have_referable_subject(merge_request, reply: true)
is_expected.to have_body_text(status)
is_expected.to have_body_text(current_user_sanitized)
is_expected.to have_body_text(project_merge_request_path(project, merge_request))
is_expected.to have_link(merge_request.to_reference, href: project_merge_request_url(merge_request.target_project, merge_request))
expect(subject.text_part).to have_content(assignee.name)
expect(subject.text_part).to have_content(reviewer.name)
end
end
end
describe "#merge_when_pipeline_succeeds_email" do
let(:title) { "Merge request #{merge_request.to_reference} was scheduled to merge after pipeline succeeds by #{current_user.name}" }
......
......@@ -464,37 +464,6 @@ RSpec.describe Notify do
end
end
describe 'status changed' do
let(:status) { 'reopened' }
subject { described_class.merge_request_status_email(recipient.id, merge_request.id, status, current_user.id) }
it_behaves_like 'an answer to an existing thread with reply-by-email enabled' do
let(:model) { merge_request }
end
it_behaves_like 'it should show Gmail Actions View Merge request link'
it_behaves_like 'an unsubscribeable thread'
it_behaves_like 'appearance header and footer enabled'
it_behaves_like 'appearance header and footer not enabled'
it 'is sent as the author' do
sender = subject.header[:from].addrs[0]
expect(sender.display_name).to eq(current_user.name)
expect(sender.address).to eq(gitlab_sender)
end
it 'has the correct subject and body' do
aggregate_failures do
is_expected.to have_referable_subject(merge_request, reply: true)
is_expected.to have_body_text(status)
is_expected.to have_body_text(current_user_sanitized)
is_expected.to have_body_text(project_merge_request_path(project, merge_request))
is_expected.to have_link(merge_request.to_reference, href: project_merge_request_url(merge_request.target_project, merge_request))
end
end
end
describe 'that are unmergeable' do
let_it_be(:merge_request) do
create(:merge_request, :conflict,
......
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