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
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
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
app/models/merge_request.rb
app/models/merge_request.rb
+10
-0
spec/models/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
...
@@ -333,6 +333,16 @@ class MergeRequest < ActiveRecord::Base
update_column
(
:merge_jid
,
jid
)
update_column
(
:merge_jid
,
jid
)
end
end
def
merge_participants
participants
=
[
author
]
if
merge_when_pipeline_succeeds?
&&
!
participants
.
include?
(
merge_user
)
participants
<<
merge_user
end
participants
end
def
first_commit
def
first_commit
merge_request_diff
?
merge_request_diff
.
first_commit
:
compare_commits
.
first
merge_request_diff
?
merge_request_diff
.
first_commit
:
compare_commits
.
first
end
end
...
...
spec/models/merge_request_spec.rb
View file @
179a1ee7
...
@@ -2242,4 +2242,39 @@ describe MergeRequest do
...
@@ -2242,4 +2242,39 @@ describe MergeRequest do
expect
(
merge_request
.
can_allow_maintainer_to_push?
(
user
)).
to
be_truthy
expect
(
merge_request
.
can_allow_maintainer_to_push?
(
user
)).
to
be_truthy
end
end
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
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