BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
179a1ee7
Commit
179a1ee7
authored
May 09, 2018
by
lulalala
Committed by
Mark Chao
May 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add MergeRequest#merge_participants
For notifying via todo or email.
parent
75171053
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
merge_request.rb
app/models/merge_request.rb
+10
-0
merge_request_spec.rb
spec/models/merge_request_spec.rb
+35
-0
No files found.
app/models/merge_request.rb
View file @
179a1ee7
...
...
@@ -333,6 +333,16 @@ class MergeRequest < ActiveRecord::Base
update_column
(
:merge_jid
,
jid
)
end
def
merge_participants
participants
=
[
author
]
if
merge_when_pipeline_succeeds?
&&
!
participants
.
include?
(
merge_user
)
participants
<<
merge_user
end
participants
end
def
first_commit
merge_request_diff
?
merge_request_diff
.
first_commit
:
compare_commits
.
first
end
...
...
spec/models/merge_request_spec.rb
View file @
179a1ee7
...
...
@@ -2242,4 +2242,39 @@ describe MergeRequest do
expect
(
merge_request
.
can_allow_maintainer_to_push?
(
user
)).
to
be_truthy
end
end
describe
'#merge_participants'
do
it
'contains author'
do
expect
(
subject
.
merge_participants
).
to
eq
([
subject
.
author
])
end
describe
'when merge_when_pipeline_succeeds? is true'
do
describe
'when merge user is author'
do
let
(
:user
)
{
create
(
:user
)
}
subject
do
create
(
:merge_request
,
merge_when_pipeline_succeeds:
true
,
merge_user:
user
,
author:
user
)
end
it
'contains author only'
do
expect
(
subject
.
merge_participants
).
to
eq
([
subject
.
author
])
end
end
describe
'when merge user and author are different users'
do
let
(
:merge_user
)
{
create
(
:user
)
}
subject
do
create
(
:merge_request
,
merge_when_pipeline_succeeds:
true
,
merge_user:
merge_user
)
end
it
'contains author and merge user'
do
expect
(
subject
.
merge_participants
).
to
eq
([
subject
.
author
,
merge_user
])
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