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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
6e6f34bf
Commit
6e6f34bf
authored
Sep 26, 2016
by
Dimitris Karakasilis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Notify current_user about automatic merge after successful build
Fixes:
https://gitlab.com/gitlab-org/gitlab-ce/issues/14409
parent
f78c86bb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
5 deletions
+24
-5
CHANGELOG
CHANGELOG
+1
-0
app/services/notification_service.rb
app/services/notification_service.rb
+9
-5
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+14
-0
No files found.
CHANGELOG
View file @
6e6f34bf
...
...
@@ -15,6 +15,7 @@ v 8.13.0 (unreleased)
- Add organization field to user profile
- Optimize GitHub importing for speed and memory
- API: expose pipeline data in builds API (!6502, Guilherme Salazar)
- Notify the Merger about merge after successful build (Dimitris Karakasilis)
v 8.12.2 (unreleased)
- Added University content to doc/university
...
...
app/services/notification_service.rb
View file @
6e6f34bf
...
...
@@ -134,7 +134,8 @@ class NotificationService
merge_request
,
merge_request
.
target_project
,
current_user
,
:merged_merge_request_email
:merged_merge_request_email
,
skip_current_user:
!
merge_request
.
merge_when_build_succeeds?
)
end
...
...
@@ -514,9 +515,11 @@ class NotificationService
end
end
def
close_resource_email
(
target
,
project
,
current_user
,
method
)
def
close_resource_email
(
target
,
project
,
current_user
,
method
,
skip_current_user:
true
)
action
=
method
==
:merged_merge_request_email
?
"merge"
:
"close"
recipients
=
build_recipients
(
target
,
project
,
current_user
,
action:
action
)
recipients
=
build_recipients
(
target
,
project
,
current_user
,
action:
action
,
skip_current_user:
skip_current_user
)
recipients
.
each
do
|
recipient
|
mailer
.
send
(
method
,
recipient
.
id
,
target
.
id
,
current_user
.
id
).
deliver_later
...
...
@@ -557,7 +560,7 @@ class NotificationService
end
end
def
build_recipients
(
target
,
project
,
current_user
,
action:
nil
,
previous_assignee:
nil
)
def
build_recipients
(
target
,
project
,
current_user
,
action:
nil
,
previous_assignee:
nil
,
skip_current_user:
true
)
custom_action
=
build_custom_key
(
action
,
target
)
recipients
=
target
.
participants
(
current_user
)
...
...
@@ -586,7 +589,8 @@ class NotificationService
recipients
=
reject_unsubscribed_users
(
recipients
,
target
)
recipients
=
reject_users_without_access
(
recipients
,
target
)
recipients
.
delete
(
current_user
)
recipients
.
delete
(
current_user
)
if
skip_current_user
recipients
.
uniq
end
...
...
spec/services/notification_service_spec.rb
View file @
6e6f34bf
...
...
@@ -962,6 +962,20 @@ describe NotificationService, services: true do
should_not_email
(
@u_lazy_participant
)
end
it
"notifies the merger when merge_when_build_succeeds is true"
do
merge_request
.
merge_when_build_succeeds
=
true
notification
.
merge_mr
(
merge_request
,
@u_watcher
)
should_email
(
@u_watcher
)
end
it
"does not notify the merger when merge_when_build_succeeds is false"
do
merge_request
.
merge_when_build_succeeds
=
false
notification
.
merge_mr
(
merge_request
,
@u_watcher
)
should_not_email
(
@u_watcher
)
end
context
'participating'
do
context
'by assignee'
do
before
do
...
...
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