diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-09-08 19:22:33 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-10-04 22:49:41 +0200 |
commit | 8f6dac4991ba7f5771a24175784f19dc1bbd4103 (patch) | |
tree | 5d4f4c06f6bd56db03474dd5d97002d82331a91e /app/controllers/groups_controller.rb | |
parent | 518216c0627cb6c4b3db62f10877b44d0e912ddb (diff) | |
download | gitlab-ce-8f6dac4991ba7f5771a24175784f19dc1bbd4103.tar.gz |
Allow filtering children for a group
When fetching children for a group with a filter, we will search all
nested groups for results and render them in an expanded tree
Diffstat (limited to 'app/controllers/groups_controller.rb')
-rw-r--r-- | app/controllers/groups_controller.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index a714f2cc7b0..575d5476867 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -74,11 +74,11 @@ class GroupsController < Groups::ApplicationController respond_to do |format| format.json do - render json: GroupChildSerializer - .new(current_user: current_user) - .with_pagination(request, response) - .hierarchy_base(parent, open_hierarchy: filter[:filter].present) - .represent(@children) + serializer = GroupChildSerializer + .new(current_user: current_user) + .with_pagination(request, response) + serializer.expand_hierarchy(parent) if params[:filter].present? + render json: serializer.represent(@children) end end end |