diff --git a/app/mailers/previews/notify_preview.rb b/app/mailers/previews/notify_preview.rb index c70ac1428cdf8cd0622d1145e3573cbc60536750..f29d0d990b6bf6e306ea3d46548ce38eacf70721 100644 --- a/app/mailers/previews/notify_preview.rb +++ b/app/mailers/previews/notify_preview.rb @@ -89,7 +89,7 @@ def closed_merge_request_email 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 diff --git a/app/views/notify/merge_request_status_email.text.haml b/app/views/notify/merge_request_status_email.text.haml index 3d7115856d49316083a5a7fb958cdd5e033db1f2..ab663b651993c6c705d5595e3dc638d1754bde30 100644 --- a/app/views/notify/merge_request_status_email.text.haml +++ b/app/views/notify/merge_request_status_email.text.haml @@ -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) diff --git a/changelogs/unreleased/300750-add-missing-reviewers-information-to-merge_request_status_email.yml b/changelogs/unreleased/300750-add-missing-reviewers-information-to-merge_request_status_email.yml new file mode 100644 index 0000000000000000000000000000000000000000..83712f4b799fd0290e9a51c5574ba93a0dd722d5 --- /dev/null +++ b/changelogs/unreleased/300750-add-missing-reviewers-information-to-merge_request_status_email.yml @@ -0,0 +1,5 @@ +--- +title: Add reviewers detail to merge request status email +merge_request: 55584 +author: +type: added diff --git a/spec/mailers/emails/merge_requests_spec.rb b/spec/mailers/emails/merge_requests_spec.rb index d127867aa8250e966e0df16acd9ca5868dd74ecd..99a4730e22b3a717cb9786acead12af342bdbac8 100644 --- a/spec/mailers/emails/merge_requests_spec.rb +++ b/spec/mailers/emails/merge_requests_spec.rb @@ -90,6 +90,40 @@ 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}" } diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index 762c57615b84030a91eb412cd4309ddb444a5cf1..17ed3e967a1b7e3f44ac46ec49f06cb299f780e0 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -464,37 +464,6 @@ 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,