Commit 75969000 authored by Eugenia Grieff's avatar Eugenia Grieff

Use existing Namespace method descendants

parent 0ad0ccd0
......@@ -12,7 +12,8 @@
# all_available: boolean (defaults to true)
# min_access_level: integer
# exclude_group_ids: array of integers
# include_parent_descendants: boolean (defaults to false)
# include_parent_descendants: boolean (defaults to false) - includes descendant groups when
# filtering by parent. The parent param must be present.
#
# Users with full private access can see all groups. The `owned` and `parent`
# params can be used to restrict the groups that are returned.
......@@ -86,10 +87,7 @@ class GroupsFinder < UnionFinder
return groups unless params[:parent]
if include_parent_descendants?
descendants = Gitlab::ObjectHierarchy
.new(groups.where(id: params[:parent]))
.descendants
groups.id_in(descendants)
groups.id_in(params[:parent].descendants)
else
groups.where(parent: params[:parent])
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment