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
ec8a7a36
Commit
ec8a7a36
authored
Oct 04, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure all ancestors are loaded when searching groups
parent
dda023d6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
app/controllers/concerns/group_tree.rb
app/controllers/concerns/group_tree.rb
+1
-1
spec/controllers/concerns/group_tree_spec.rb
spec/controllers/concerns/group_tree_spec.rb
+2
-2
No files found.
app/controllers/concerns/group_tree.rb
View file @
ec8a7a36
...
@@ -2,7 +2,7 @@ module GroupTree
...
@@ -2,7 +2,7 @@ module GroupTree
def
render_group_tree
(
groups
)
def
render_group_tree
(
groups
)
if
params
[
:filter
].
present?
if
params
[
:filter
].
present?
@groups
=
Gitlab
::
GroupHierarchy
.
new
(
groups
).
all_groups
@groups
=
Gitlab
::
GroupHierarchy
.
new
(
groups
).
all_groups
@groups
=
@groups
.
search
(
params
[
:filter
])
@groups
=
Gitlab
::
GroupHierarchy
.
new
(
@groups
.
search
(
params
[
:filter
])).
base_and_ancestors
else
else
# Only show root groups if no parent-id is given
# Only show root groups if no parent-id is given
@groups
=
groups
.
where
(
parent_id:
params
[
:parent_id
])
@groups
=
groups
.
where
(
parent_id:
params
[
:parent_id
])
...
...
spec/controllers/concerns/group_tree_spec.rb
View file @
ec8a7a36
...
@@ -45,12 +45,12 @@ describe GroupTree do
...
@@ -45,12 +45,12 @@ describe GroupTree do
expect
(
assigns
(
:groups
)).
to
contain_exactly
(
subgroup
)
expect
(
assigns
(
:groups
)).
to
contain_exactly
(
subgroup
)
end
end
it
'allows filtering for subgroups'
do
it
'allows filtering for subgroups
and includes the parents for rendering
'
do
subgroup
=
create
(
:group
,
:public
,
parent:
group
,
name:
'filter'
)
subgroup
=
create
(
:group
,
:public
,
parent:
group
,
name:
'filter'
)
get
:index
,
filter:
'filt'
,
format: :json
get
:index
,
filter:
'filt'
,
format: :json
expect
(
assigns
(
:groups
)).
to
contain_exactly
(
subgroup
)
expect
(
assigns
(
:groups
)).
to
contain_exactly
(
group
,
subgroup
)
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