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
9f8ad0ad
Commit
9f8ad0ad
authored
Sep 08, 2016
by
Ruben Davila
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'dev/master'
parents
5fbadf3d
ca6c6991
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
1 deletion
+18
-1
CHANGELOG-EE
CHANGELOG-EE
+3
-0
app/models/merge_request.rb
app/models/merge_request.rb
+4
-1
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+11
-0
No files found.
CHANGELOG-EE
View file @
9f8ad0ad
Please view this file on the master branch, on stable branches it's out of date.
v 8.12.0 (Unreleased)
v 8.11.6
- Exclude blocked users from potential MR approvers
v 8.11.5
- API: Restore backward-compatibility for POST /projects/:id/members when membership is locked
...
...
app/models/merge_request.rb
View file @
9f8ad0ad
...
...
@@ -677,7 +677,10 @@ class MergeRequest < ActiveRecord::Base
wheres
<<
"id IN (
#{
project
.
group
.
members
.
where
(
has_access
).
select
(
:user_id
).
to_sql
}
)"
end
User
.
where
(
"(
#{
wheres
.
join
(
' OR '
)
}
) AND id NOT IN (
#{
approvals
.
select
(
:user_id
).
to_sql
}
) AND id !=
#{
author
.
id
}
"
).
count
User
.
active
.
where
(
"(
#{
wheres
.
join
(
' OR '
)
}
) AND id NOT IN (
#{
approvals
.
select
(
:user_id
).
to_sql
}
) AND id !=
#{
author
.
id
}
"
).
count
end
# Users in the list of approvers who have not already approved this MR.
...
...
spec/models/merge_request_spec.rb
View file @
9f8ad0ad
...
...
@@ -336,6 +336,15 @@ describe MergeRequest, models: true do
end
.
to
change
{
merge_request
.
number_of_potential_approvers
}.
by
(
1
)
end
it
"excludes blocked users"
do
developer
=
create
(
:user
)
blocked_developer
=
create
(
:user
).
tap
{
|
u
|
u
.
block!
}
project
.
team
<<
[
developer
,
:developer
]
project
.
team
<<
[
blocked_developer
,
:developer
]
expect
(
merge_request
.
number_of_potential_approvers
).
to
eq
(
1
)
end
context
"when the project is part of a group"
do
let
(
:group
)
{
create
(
:group
)
}
before
{
project
.
update_attributes
(
group:
group
)
}
...
...
@@ -346,6 +355,8 @@ describe MergeRequest, models: true do
group
.
add_reporter
(
create
(
:user
))
group
.
add_developer
(
create
(
:user
))
group
.
add_master
(
create
(
:user
))
blocked_developer
=
create
(
:user
).
tap
{
|
u
|
u
.
block!
}
group
.
add_developer
(
blocked_developer
)
end
.
to
change
{
merge_request
.
number_of_potential_approvers
}.
by
(
2
)
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