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
Boxiang Sun
gitlab-ce
Commits
b92e7103
Commit
b92e7103
authored
Sep 26, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix nesting bug when rendering children of a shared subgroup
parent
ac0b104a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
2 deletions
+28
-2
app/finders/group_descendants_finder.rb
app/finders/group_descendants_finder.rb
+1
-1
app/serializers/group_child_serializer.rb
app/serializers/group_child_serializer.rb
+1
-1
spec/controllers/groups_controller_spec.rb
spec/controllers/groups_controller_spec.rb
+26
-0
No files found.
app/finders/group_descendants_finder.rb
View file @
b92e7103
...
...
@@ -64,7 +64,7 @@ class GroupDescendantsFinder
subgroups_with_counts
=
ancestors_for_project_search
.
with_route
.
select
(
group_selects
)
|
subgroups_with_counts
end
@children
=
subgroups_with_counts
+
projects
.
preload
(
:route
)
@children
=
subgroups_with_counts
+
projects
.
with_route
end
def
direct_child_groups
...
...
app/serializers/group_child_serializer.rb
View file @
b92e7103
...
...
@@ -41,7 +41,7 @@ class GroupChildSerializer < BaseSerializer
.
merge
(
children:
Array
.
wrap
(
serializer
.
represent_hierarchy
(
children
,
opts
)))
end
elsif
hierarchy
.
is_a?
(
Array
)
hierarchy
.
map
{
|
child
|
serializer
.
represent_hierarchy
(
child
,
opts
)
}
hierarchy
.
map
{
|
child
|
serializer
.
represent_hierarchy
(
child
,
opts
)
}
.
flatten
else
serializer
.
represent
(
hierarchy
,
opts
)
end
...
...
spec/controllers/groups_controller_spec.rb
View file @
b92e7103
...
...
@@ -293,6 +293,32 @@ describe GroupsController do
expect
(
matched_group_json
[
'id'
]).
to
eq
(
matched_group
.
id
)
end
it
'merges the trees correctly'
do
shared_subgroup
=
create
(
:group
,
:public
,
parent:
group
,
path:
'hardware'
)
matched_project_1
=
create
(
:project
,
:public
,
namespace:
shared_subgroup
,
name:
'mobile-soc'
)
l2_subgroup
=
create
(
:group
,
:public
,
parent:
shared_subgroup
,
path:
'broadcom'
)
l3_subgroup
=
create
(
:group
,
:public
,
parent:
l2_subgroup
,
path:
'wifi-group'
)
matched_project_2
=
create
(
:project
,
:public
,
namespace:
l3_subgroup
,
name:
'mobile'
)
get
:children
,
id:
group
.
to_param
,
filter:
'mobile'
,
format: :json
shared_group_json
=
json_response
.
first
expect
(
shared_group_json
[
'id'
]).
to
eq
(
shared_subgroup
.
id
)
matched_project_1_json
=
shared_group_json
[
'children'
].
detect
{
|
child
|
child
[
'type'
]
==
'project'
}
expect
(
matched_project_1_json
[
'id'
]).
to
eq
(
matched_project_1
.
id
)
l2_subgroup_json
=
shared_group_json
[
'children'
].
detect
{
|
child
|
child
[
'type'
]
==
'group'
}
expect
(
l2_subgroup_json
[
'id'
]).
to
eq
(
l2_subgroup
.
id
)
l3_subgroup_json
=
l2_subgroup_json
[
'children'
].
first
expect
(
l3_subgroup_json
[
'id'
]).
to
eq
(
l3_subgroup
.
id
)
matched_project_2_json
=
l3_subgroup_json
[
'children'
].
first
expect
(
matched_project_2_json
[
'id'
]).
to
eq
(
matched_project_2
.
id
)
end
it
'includes pagination headers'
do
2
.
times
{
|
i
|
create
(
:group
,
:public
,
parent:
public_subgroup
,
name:
"filterme
#{
i
}
"
)
}
...
...
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