summaryrefslogtreecommitdiff
path: root/app/controllers/concerns
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-09-14 09:01:29 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2017-10-04 22:49:41 +0200
commitea4e17e2aec525f249430b0a22dc6a8450648837 (patch)
tree99246d63a3bec435c9a62dcdf111ae2d86c610e7 /app/controllers/concerns
parent3a4dc55f2924debcdbb37eb63d8ce57b1358df81 (diff)
downloadgitlab-ce-ea4e17e2aec525f249430b0a22dc6a8450648837.tar.gz
Search subgroups on dashboard and explore views
Diffstat (limited to 'app/controllers/concerns')
-rw-r--r--app/controllers/concerns/group_tree.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/controllers/concerns/group_tree.rb b/app/controllers/concerns/group_tree.rb
index 6d5682ff769..d094216aa58 100644
--- a/app/controllers/concerns/group_tree.rb
+++ b/app/controllers/concerns/group_tree.rb
@@ -1,8 +1,12 @@
module GroupTree
def render_group_tree(groups)
- # Only show root groups if no parent-id is given
- @groups = groups.where(parent_id: params[:parent_id])
- @groups = @groups.search(params[:filter]) if params[:filter].present?
+ if params[:filter].present?
+ @groups = Gitlab::GroupHierarchy.new(groups).all_groups
+ @groups = @groups.search(params[:filter])
+ else
+ # Only show root groups if no parent-id is given
+ @groups = groups.where(parent_id: params[:parent_id])
+ end
@groups = @groups.includes(:route)
@groups = @groups.sort(@sort = params[:sort])
@groups = @groups.page(params[:page])
@@ -12,6 +16,7 @@ module GroupTree
format.json do
serializer = GroupChildSerializer.new(current_user: current_user)
.with_pagination(request, response)
+ serializer.expand_hierarchy if params[:filter].present?
render json: serializer.represent(@groups)
end
end