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
Léo-Paul Géneau
gitlab-ce
Commits
f2a0c6f6
Commit
f2a0c6f6
authored
Nov 23, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly determine mergeability of MR with no discussions
parent
d0c0c75c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
1 deletion
+63
-1
app/models/merge_request.rb
app/models/merge_request.rb
+5
-1
changelogs/unreleased/24863-mrs-without-discussions-are-mergeable.yml
...nreleased/24863-mrs-without-discussions-are-mergeable.yml
+4
-0
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+54
-0
No files found.
app/models/merge_request.rb
View file @
f2a0c6f6
...
...
@@ -494,10 +494,14 @@ class MergeRequest < ActiveRecord::Base
discussions_resolvable?
&&
diff_discussions
.
none?
(
&
:to_be_resolved?
)
end
def
discussions_to_be_resolved?
discussions_resolvable?
&&
!
discussions_resolved?
end
def
mergeable_discussions_state?
return
true
unless
project
.
only_allow_merge_if_all_discussions_are_resolved?
discussions
_resolved?
!
discussions_to_be
_resolved?
end
def
hook_attrs
...
...
changelogs/unreleased/24863-mrs-without-discussions-are-mergeable.yml
0 → 100644
View file @
f2a0c6f6
---
title
:
Correctly determine mergeability of MR with no discussions
merge_request
:
author
:
spec/models/merge_request_spec.rb
View file @
f2a0c6f6
...
...
@@ -937,6 +937,16 @@ describe MergeRequest, models: true do
expect
(
merge_request
.
mergeable_discussions_state?
).
to
be_falsey
end
end
context
'with no discussions'
do
before
do
merge_request
.
notes
.
destroy_all
end
it
'returns true'
do
expect
(
merge_request
.
mergeable_discussions_state?
).
to
be_truthy
end
end
end
context
'when project.only_allow_merge_if_all_discussions_are_resolved == false'
do
...
...
@@ -1198,6 +1208,50 @@ describe MergeRequest, models: true do
end
end
end
describe
"#discussions_to_be_resolved?"
do
context
"when discussions are not resolvable"
do
before
do
allow
(
subject
).
to
receive
(
:discussions_resolvable?
).
and_return
(
false
)
end
it
"returns false"
do
expect
(
subject
.
discussions_to_be_resolved?
).
to
be
false
end
end
context
"when discussions are resolvable"
do
before
do
allow
(
subject
).
to
receive
(
:discussions_resolvable?
).
and_return
(
true
)
allow
(
first_discussion
).
to
receive
(
:resolvable?
).
and_return
(
true
)
allow
(
second_discussion
).
to
receive
(
:resolvable?
).
and_return
(
false
)
allow
(
third_discussion
).
to
receive
(
:resolvable?
).
and_return
(
true
)
end
context
"when all resolvable discussions are resolved"
do
before
do
allow
(
first_discussion
).
to
receive
(
:resolved?
).
and_return
(
true
)
allow
(
third_discussion
).
to
receive
(
:resolved?
).
and_return
(
true
)
end
it
"returns false"
do
expect
(
subject
.
discussions_to_be_resolved?
).
to
be
false
end
end
context
"when some resolvable discussions are not resolved"
do
before
do
allow
(
first_discussion
).
to
receive
(
:resolved?
).
and_return
(
true
)
allow
(
third_discussion
).
to
receive
(
:resolved?
).
and_return
(
false
)
end
it
"returns true"
do
expect
(
subject
.
discussions_to_be_resolved?
).
to
be
true
end
end
end
end
end
describe
'#conflicts_can_be_resolved_in_ui?'
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