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
8fcdfeae
Commit
8fcdfeae
authored
Nov 23, 2016
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '24863-mrs-without-discussions-are-mergeable' into 'master'
Closes
https://gitlab.com/gitlab-org/gitlab-ce/issues/24863
See merge request !7698
parents
4646d453
f2a0c6f6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
1 deletion
+63
-1
merge_request.rb
app/models/merge_request.rb
+5
-1
24863-mrs-without-discussions-are-mergeable.yml
...nreleased/24863-mrs-without-discussions-are-mergeable.yml
+4
-0
merge_request_spec.rb
spec/models/merge_request_spec.rb
+54
-0
No files found.
app/models/merge_request.rb
View file @
8fcdfeae
...
...
@@ -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 @
8fcdfeae
---
title
:
Correctly determine mergeability of MR with no discussions
merge_request
:
author
:
spec/models/merge_request_spec.rb
View file @
8fcdfeae
...
...
@@ -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