Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4fce0c87
Commit
4fce0c87
authored
Mar 12, 2021
by
David Kim
Committed by
Gabriel Mazetto
Mar 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add reviewers detail to approve/unapprove MR emails
parent
1e7ea614
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
34 deletions
+45
-34
ee/app/views/notify/approved_merge_request_email.html.haml
ee/app/views/notify/approved_merge_request_email.html.haml
+6
-12
ee/app/views/notify/approved_merge_request_email.text.haml
ee/app/views/notify/approved_merge_request_email.text.haml
+1
-0
ee/app/views/notify/unapproved_merge_request_email.html.haml
ee/app/views/notify/unapproved_merge_request_email.html.haml
+5
-12
ee/app/views/notify/unapproved_merge_request_email.text.haml
ee/app/views/notify/unapproved_merge_request_email.text.haml
+1
-0
ee/changelogs/unreleased/300750-add-missing-reviewers-information-to-approve-unapprove-merge-reque.yml
...eviewers-information-to-approve-unapprove-merge-reque.yml
+5
-0
ee/spec/mailers/ee/emails/merge_requests_spec.rb
ee/spec/mailers/ee/emails/merge_requests_spec.rb
+27
-10
No files found.
ee/app/views/notify/approved_merge_request_email.html.haml
View file @
4fce0c87
...
@@ -42,13 +42,13 @@
...
@@ -42,13 +42,13 @@
}
}
}
}
ul
.
assignee
s-list
{
ul
.
user
s-list
{
list-style
:
none
;
list-style
:
none
;
padding
:
0px
;
padding
:
0px
;
display
:
block
;
display
:
block
;
margin-top
:
0px
;
margin-top
:
0px
;
}
}
ul
.
assignee
s-list
li
{
ul
.
user
s-list
li
{
display
:
inline-block
;
display
:
inline-block
;
padding-right
:
12px
;
padding-right
:
12px
;
padding-top
:
8px
;
padding-top
:
8px
;
...
@@ -136,16 +136,10 @@
...
@@ -136,16 +136,10 @@
=
@merge_request
.
author
.
name
=
@merge_request
.
author
.
name
-
if
@merge_request
.
assignees
.
any?
-
if
@merge_request
.
assignees
.
any?
%tr
=
render
'users_list'
,
users:
@merge_request
.
assignees
,
user_label:
assignees_label
(
@merge_request
,
include_value:
false
)
%td
{
style:
"font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;line-height:1.4;color:#8c8c8c;font-weight:300;padding:14px 0;margin:0;border-top:1px solid #ededed;"
}
=
assignees_label
(
@merge_request
,
include_value:
false
)
-
if
@merge_request
.
reviewers
.
any?
%td
{
style:
"font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; margin: 0; padding: 14px 0 0px 5px; font-size: 15px; line-height: 1.4; color: #333333; font-weight: 400; width: 75%; border-top-style: solid; border-top-color: #ededed; border-top-width: 1px; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; mso-table-lspace: 0pt; mso-table-rspace: 0pt;"
}
=
render
'users_list'
,
users:
@merge_request
.
reviewers
,
user_label:
reviewers_label
(
@merge_request
,
include_value:
false
)
%ul
.assignees-list
{
style:
"font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 15px; line-height: 1.4; padding-right: 5px; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; mso-table-lspace: 0pt; mso-table-rspace: 0pt;"
}
-
@merge_request
.
assignees
.
each
do
|
assignee
|
%li
%img
.avatar
{
alt:
"Avatar"
,
height:
"24"
,
src:
avatar_icon_for_user
(
assignee
,
24
,
only_path:
false
),
style:
"border-radius: 12px; max-width: 100%; height: auto; -ms-interpolation-mode: bicubic; margin: -2px 0;"
,
width:
"24"
}
/
%a
.muted
{
href:
user_url
(
assignee
),
style:
"color: #333333; text-decoration: none; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; vertical-align: top;"
}
=
assignee
.
name
-# EE-specific start
-# EE-specific start
=
render
'layouts/mailer/additional_text'
=
render
'layouts/mailer/additional_text'
...
...
ee/app/views/notify/approved_merge_request_email.text.haml
View file @
4fce0c87
...
@@ -6,3 +6,4 @@ Merge Request URL: #{project_merge_request_url(@merge_request.target_project, @m
...
@@ -6,3 +6,4 @@ Merge Request URL: #{project_merge_request_url(@merge_request.target_project, @m
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
)
ee/app/views/notify/unapproved_merge_request_email.html.haml
View file @
4fce0c87
...
@@ -42,13 +42,13 @@
...
@@ -42,13 +42,13 @@
}
}
}
}
ul
.
assignee
s-list
{
ul
.
user
s-list
{
list-style
:
none
;
list-style
:
none
;
padding
:
0px
;
padding
:
0px
;
display
:
block
;
display
:
block
;
margin-top
:
0px
;
margin-top
:
0px
;
}
}
ul
.
assignee
s-list
li
{
ul
.
user
s-list
li
{
display
:
inline-block
;
display
:
inline-block
;
padding-right
:
12px
;
padding-right
:
12px
;
padding-top
:
8px
;
padding-top
:
8px
;
...
@@ -135,17 +135,10 @@
...
@@ -135,17 +135,10 @@
%a
.muted
{
href:
user_url
(
@merge_request
.
author
),
style:
"color:#333333;text-decoration:none;"
}
%a
.muted
{
href:
user_url
(
@merge_request
.
author
),
style:
"color:#333333;text-decoration:none;"
}
=
@merge_request
.
author
.
name
=
@merge_request
.
author
.
name
-
if
@merge_request
.
assignees
.
any?
-
if
@merge_request
.
assignees
.
any?
%tr
=
render
'users_list'
,
users:
@merge_request
.
assignees
,
user_label:
assignees_label
(
@merge_request
,
include_value:
false
)
%td
{
style:
"font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;line-height:1.4;color:#8c8c8c;font-weight:300;padding:14px 0;margin:0;border-top:1px solid #ededed;"
}
=
assignees_label
(
@merge_request
,
include_value:
false
)
%td
{
style:
"font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; margin: 0; padding: 14px 0 0px 5px; font-size: 15px; line-height: 1.4; color: #333333; font-weight: 400; width: 75%; border-top-style: solid; border-top-color: #ededed; border-top-width: 1px; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; mso-table-lspace: 0pt; mso-table-rspace: 0pt;"
}
%ul
.assignees-list
{
style:
"font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 15px; line-height: 1.4; padding-right: 5px; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; mso-table-lspace: 0pt; mso-table-rspace: 0pt;"
}
-
@merge_request
.
assignees
.
each
do
|
assignee
|
%li
%img
.avatar
{
alt:
"Avatar"
,
height:
"24"
,
src:
avatar_icon_for_user
(
assignee
,
24
,
only_path:
false
),
style:
"border-radius: 12px; max-width: 100%; height: auto; -ms-interpolation-mode: bicubic; margin: -2px 0;"
,
width:
"24"
}
/
%a
.muted
{
href:
user_url
(
assignee
),
style:
"color: #333333; text-decoration: none; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; vertical-align: top;"
}
=
assignee
.
name
-
if
@merge_request
.
reviewers
.
any?
=
render
'users_list'
,
users:
@merge_request
.
reviewers
,
user_label:
reviewers_label
(
@merge_request
,
include_value:
false
)
-# EE-specific start
-# EE-specific start
=
render
'layouts/mailer/additional_text'
=
render
'layouts/mailer/additional_text'
-# EE-specific end
-# EE-specific end
...
...
ee/app/views/notify/unapproved_merge_request_email.text.haml
View file @
4fce0c87
...
@@ -6,3 +6,4 @@ Merge Request URL: #{project_merge_request_url(@merge_request.target_project, @m
...
@@ -6,3 +6,4 @@ Merge Request URL: #{project_merge_request_url(@merge_request.target_project, @m
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
)
ee/changelogs/unreleased/300750-add-missing-reviewers-information-to-approve-unapprove-merge-reque.yml
0 → 100644
View file @
4fce0c87
---
title
:
Add reviewers detail to approved and unapproved merge request emails
merge_request
:
56290
author
:
type
:
added
ee/spec/mailers/ee/emails/merge_requests_spec.rb
View file @
4fce0c87
...
@@ -6,12 +6,15 @@ require 'email_spec'
...
@@ -6,12 +6,15 @@ require 'email_spec'
RSpec
.
describe
EE
::
Emails
::
MergeRequests
do
RSpec
.
describe
EE
::
Emails
::
MergeRequests
do
include
EmailSpec
::
Matchers
include
EmailSpec
::
Matchers
let
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:current_user
)
{
create
(
:user
)
}
let
(
:merge_request
)
{
create
(
:merge_request
)
}
let_it_be
(
:assignee
,
reload:
true
)
{
create
(
:user
,
email:
'assignee@example.com'
,
name:
'John Doe'
)
}
let
(
:current_user
)
{
create
(
:user
)
}
let_it_be
(
:reviewer
,
reload:
true
)
{
create
(
:user
,
email:
'reviewer@example.com'
,
name:
'Jane Doe'
)
}
let_it_be
(
:merge_request
)
{
create
(
:merge_request
,
assignees:
[
assignee
],
reviewers:
[
reviewer
])
}
let
(
:recipient
)
{
assignee
}
describe
'#add_merge_request_approver_email'
do
describe
'#add_merge_request_approver_email'
do
subject
{
Notify
.
add_merge_request_approver_email
(
user
.
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
'includes the name of the person who added the approver'
do
...
@@ -31,18 +34,32 @@ RSpec.describe EE::Emails::MergeRequests do
...
@@ -31,18 +34,32 @@ RSpec.describe EE::Emails::MergeRequests do
end
end
describe
'#approved_merge_request_email'
do
describe
'#approved_merge_request_email'
do
subject
{
Notify
.
approved_merge_request_email
(
user
.
id
,
merge_request
.
id
,
current_user
.
id
)
}
subject
{
Notify
.
approved_merge_request_email
(
recipient
.
id
,
merge_request
.
id
,
current_user
.
id
)
}
it
'includes the name of the approver'
do
it
'has the correct body'
do
expect
(
subject
).
to
have_body_text
(
current_user
.
name
)
aggregate_failures
do
is_expected
.
to
have_body_text
(
'was approved by'
)
is_expected
.
to
have_body_text
(
current_user
.
name
)
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
describe
'#unapproved_merge_request_email'
do
describe
'#unapproved_merge_request_email'
do
subject
{
Notify
.
unapproved_merge_request_email
(
user
.
id
,
merge_request
.
id
,
current_user
.
id
)
}
subject
{
Notify
.
unapproved_merge_request_email
(
recipient
.
id
,
merge_request
.
id
,
current_user
.
id
)
}
it
'includes the name of the person who removed their approval'
do
it
'has the correct body'
do
expect
(
subject
).
to
have_body_text
(
current_user
.
name
)
aggregate_failures
do
is_expected
.
to
have_body_text
(
'was unapproved by'
)
is_expected
.
to
have_body_text
(
current_user
.
name
)
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment