Commit 5330e1a2 authored by Sean McGivern's avatar Sean McGivern

Merge branch...

Merge branch '300750-add-missing-reviewers-information-to-add_merge_request_approver_email' into 'master'

Add reviewers detail to add merge request approver email

See merge request gitlab-org/gitlab!56466
parents 48265025 240d94f4
- if Gitlab::CurrentSettings.email_author_in_body - if Gitlab::CurrentSettings.email_author_in_body
%div %div
#{link_to @updated_by.name, user_url(@updated_by)} added you as an approver for: #{link_to @updated_by.name, user_url(@updated_by)} added you as an approver for:
%p.details %p
= merge_path_description(@merge_request, '→') .details
= merge_path_description(@merge_request, '→')
- if @merge_request.assignees.any? .author
%p Author: #{sanitize_name(@merge_request.author_name)}
- label = assignees_label(@merge_request, include_value: false) .assignee
- author_name = sanitize_name(@merge_request.author_name) = assignees_label(@merge_request)
- assignee_list = sanitize_name(@merge_request.assignee_list) .reviewer
= reviewers_label(@merge_request)
"#{label}: #{author_name} → #{assignee_list}" .approvers
= render 'notify/merge_request_approvers', presenter: @mr_presenter
= render_if_exists 'notify/merge_request_approvers', presenter: @mr_presenter
- if @merge_request.description - if @merge_request.description
= markdown(@merge_request.description, pipeline: :email, author: @merge_request.author) %div
= markdown(@merge_request.description, pipeline: :email, author: @merge_request.author)
...@@ -5,4 +5,5 @@ ...@@ -5,4 +5,5 @@
<%= merge_path_description(@merge_request, 'to') %> <%= merge_path_description(@merge_request, 'to') %>
Author: <%= sanitize_name(@merge_request.author_name) %> Author: <%= sanitize_name(@merge_request.author_name) %>
<%= assignees_label(@merge_request) %> <%= assignees_label(@merge_request) %>
<%= reviewers_label(@merge_request) %>
<%= render_if_exists 'notify/merge_request_approvers', presenter: @mr_presenter %> <%= render_if_exists 'notify/merge_request_approvers', presenter: @mr_presenter %>
---
title: Add reviewers detail to add merge request approver email
merge_request: 56466
author:
type: added
...@@ -17,18 +17,32 @@ RSpec.describe EE::Emails::MergeRequests do ...@@ -17,18 +17,32 @@ RSpec.describe EE::Emails::MergeRequests do
subject { Notify.add_merge_request_approver_email(recipient.id, merge_request.id, current_user.id) } subject { Notify.add_merge_request_approver_email(recipient.id, merge_request.id, current_user.id) }
context 'when email_author_in_body is set' do context 'when email_author_in_body is set' do
it 'includes the name of the person who added the approver' do it 'has the correct body with the name of the person who added the approver' do
stub_application_setting(email_author_in_body: true) stub_application_setting(email_author_in_body: true)
expect(subject).to have_body_text(current_user.name) aggregate_failures do
is_expected.to have_body_text(current_user.name)
is_expected.to have_body_text('added you as an approver')
is_expected.to have_text_part_content(assignee.name)
is_expected.to have_html_part_content(assignee.name)
is_expected.to have_text_part_content(reviewer.name)
is_expected.to have_html_part_content(reviewer.name)
end
end end
end end
context 'when email_author_in_body is not set' do context 'when email_author_in_body is not set' do
it 'does not include the name of the person who added the approver' do it 'has the correct body without the name of the person who added the approver' do
stub_application_setting(email_author_in_body: false) stub_application_setting(email_author_in_body: false)
expect(subject).not_to have_body_text(current_user.name) aggregate_failures do
is_expected.not_to have_body_text(current_user.name)
is_expected.not_to have_body_text('added you as an approver')
is_expected.to have_text_part_content(assignee.name)
is_expected.to have_html_part_content(assignee.name)
is_expected.to have_text_part_content(reviewer.name)
is_expected.to have_html_part_content(reviewer.name)
end
end end
end 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