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
e29e63fd
Commit
e29e63fd
authored
Oct 30, 2015
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
When someone as marked as a required approver for a merge request, an email should be sent
parent
2e5596bb
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
1 deletion
+45
-1
CHANGELOG-EE
CHANGELOG-EE
+1
-0
app/models/merge_request.rb
app/models/merge_request.rb
+2
-0
app/views/notify/new_merge_request_email.html.haml
app/views/notify/new_merge_request_email.html.haml
+4
-0
app/views/notify/new_merge_request_email.text.erb
app/views/notify/new_merge_request_email.text.erb
+3
-0
spec/factories/approvers.rb
spec/factories/approvers.rb
+8
-0
spec/factories/merge_requests.rb
spec/factories/merge_requests.rb
+7
-0
spec/mailers/notify_spec.rb
spec/mailers/notify_spec.rb
+20
-1
No files found.
CHANGELOG-EE
View file @
e29e63fd
v 8.2.0
- Invalidate stored jira password if the endpoint URL is changed
- Fix: Page is not reloaded periodically to check if rebase is finished
- When someone as marked as a required approver for a merge request, an email should be sent
v 8.1.0 (unreleased)
- added an issues template (Hannes Rosenögger)
...
...
app/models/merge_request.rb
View file @
e29e63fd
...
...
@@ -135,6 +135,8 @@ class MergeRequest < ActiveRecord::Base
scope
:closed
,
->
{
with_state
(
:closed
)
}
scope
:closed_and_merged
,
->
{
with_states
(
:closed
,
:merged
)
}
participant
:approvers_left
def
self
.
reference_prefix
'!'
end
...
...
app/views/notify/new_merge_request_email.html.haml
View file @
e29e63fd
...
...
@@ -5,5 +5,9 @@
%p
Assignee:
#{
@merge_request
.
author_name
}
→
#{
@merge_request
.
assignee_name
}
-
if
@merge_request
.
approvers
.
any?
%p
Approvers:
#{
render_items_list
(
@merge_request
.
approvers_left
.
map
(
&
:name
))
}
-
if
@merge_request
.
description
=
markdown
(
@merge_request
.
description
,
pipeline: :email
)
app/views/notify/new_merge_request_email.text.erb
View file @
e29e63fd
...
...
@@ -5,4 +5,7 @@ New Merge Request #<%= @merge_request.iid %>
<%=
merge_path_description
(
@merge_request
,
'to'
)
%>
Author:
<%=
@merge_request
.
author_name
%>
Assignee:
<%=
@merge_request
.
assignee_name
%>
<%
if
@merge_request
.
approvers
.
any?
%>
Approvers:
<%=
render_items_list
(
@merge_request
.
approvers_left
.
map
(
&
:name
))
%>
<%
end
%>
spec/factories/approvers.rb
0 → 100644
View file @
e29e63fd
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl
.
define
do
factory
:approver
do
target
factory: :merge_request
user
end
end
spec/factories/merge_requests.rb
View file @
e29e63fd
...
...
@@ -64,8 +64,15 @@ FactoryGirl.define do
target_branch
"master"
end
trait
:with_approver
do
after
:create
do
|
merge_request
|
create
:approver
,
target:
merge_request
end
end
factory
:closed_merge_request
,
traits:
[
:closed
]
factory
:reopened_merge_request
,
traits:
[
:reopened
]
factory
:merge_request_with_diffs
,
traits:
[
:with_diffs
]
factory
:merge_request_with_approver
,
traits:
[
:with_approver
]
end
end
spec/mailers/notify_spec.rb
View file @
e29e63fd
...
...
@@ -276,6 +276,7 @@ describe Notify do
let
(
:merge_author
)
{
create
(
:user
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
author:
current_user
,
assignee:
assignee
,
source_project:
project
,
target_project:
project
)
}
let
(
:merge_request_with_description
)
{
create
(
:merge_request
,
author:
current_user
,
assignee:
assignee
,
source_project:
project
,
target_project:
project
,
description:
FFaker
::
Lorem
.
sentence
)
}
let
(
:merge_request_with_approver
)
{
create
(
:merge_request_with_approver
,
author:
current_user
,
assignee:
assignee
,
source_project:
project
,
target_project:
project
)
}
describe
'that are new'
do
subject
{
Notify
.
new_merge_request_email
(
merge_request
.
assignee_id
,
merge_request
.
id
)
}
...
...
@@ -304,8 +305,26 @@ describe Notify do
end
end
describe
"that are new with approver"
do
subject
do
Notify
.
new_merge_request_email
(
merge_request_with_approver
.
assignee_id
,
merge_request_with_approver
.
id
)
end
it
"contains the approvers list"
do
is_expected
.
to
have_body_text
/
#{
merge_request_with_approver
.
approvers
.
first
.
user
.
name
}
/
end
end
describe
'that are new with a description'
do
subject
{
Notify
.
new_merge_request_email
(
merge_request_with_description
.
assignee_id
,
merge_request_with_description
.
id
)
}
subject
do
Notify
.
new_merge_request_email
(
merge_request_with_description
.
assignee_id
,
merge_request_with_description
.
id
)
end
it
'contains the description'
do
is_expected
.
to
have_body_text
/
#{
merge_request_with_description
.
description
}
/
...
...
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