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
cf6ff601
Commit
cf6ff601
authored
Nov 13, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix users autocomplete in a subgroup
We should include users who have access from parent groups, not just direct members of the current group.
parent
95661d7b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletion
+21
-1
autocomplete_users_finder.rb
app/finders/autocomplete_users_finder.rb
+1
-1
fix-subgroup-autocomplete.yml
changelogs/unreleased/fix-subgroup-autocomplete.yml
+5
-0
autocomplete_users_finder_spec.rb
spec/finders/autocomplete_users_finder_spec.rb
+15
-0
No files found.
app/finders/autocomplete_users_finder.rb
View file @
cf6ff601
...
...
@@ -45,7 +45,7 @@ class AutocompleteUsersFinder
def
find_users
return
users_from_project
if
project
return
group
.
users
if
group
return
group
.
users
_with_parents
if
group
return
User
.
all
if
current_user
User
.
none
...
...
changelogs/unreleased/fix-subgroup-autocomplete.yml
0 → 100644
View file @
cf6ff601
---
title
:
Fix user autocomplete in subgroups
merge_request
:
author
:
type
:
fixed
spec/finders/autocomplete_users_finder_spec.rb
View file @
cf6ff601
...
...
@@ -42,6 +42,21 @@ describe AutocompleteUsersFinder do
it
{
is_expected
.
to
match_array
([
user1
])
}
end
context
'when passed a subgroup'
,
:nested_groups
do
let
(
:grandparent
)
{
create
(
:group
,
:public
)
}
let
(
:parent
)
{
create
(
:group
,
:public
,
parent:
grandparent
)
}
let
(
:child
)
{
create
(
:group
,
:public
,
parent:
parent
)
}
let
(
:group
)
{
parent
}
let!
(
:grandparent_user
)
{
create
(
:group_member
,
:developer
,
group:
grandparent
).
user
}
let!
(
:parent_user
)
{
create
(
:group_member
,
:developer
,
group:
parent
).
user
}
let!
(
:child_user
)
{
create
(
:group_member
,
:developer
,
group:
child
).
user
}
it
'includes users from parent groups as well'
do
expect
(
subject
).
to
match_array
([
grandparent_user
,
parent_user
])
end
end
it
{
is_expected
.
to
match_array
([
user1
,
external_user
,
omniauth_user
,
current_user
])
}
context
'when filtered by search'
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