diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-09-05 16:57:46 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-10-04 22:46:49 +0200 |
commit | 80780018a931ce41047ab62ed7dd6c5f1e28f08b (patch) | |
tree | 2025c03c20806078d8cd0006a4b1084f53b0630a /app/controllers/groups_controller.rb | |
parent | 648c082a23f51bdf7151b6c5f716e74c4fe6a5bd (diff) | |
download | gitlab-ce-80780018a931ce41047ab62ed7dd6c5f1e28f08b.tar.gz |
Update `children` route to handle projects and groups
Diffstat (limited to 'app/controllers/groups_controller.rb')
-rw-r--r-- | app/controllers/groups_controller.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 17d40cedd5d..c967488fff4 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -61,7 +61,11 @@ class GroupsController < Groups::ApplicationController end def children - parent = Group.find_by(parent_id: params[:parent_id]) || @group + parent = if params[:parent_id].present? + Group.find(params[:parent_id]) + else + @group + end if parent.nil? || !can?(current_user, :read_group, parent) render_404 end @@ -70,7 +74,7 @@ class GroupsController < Groups::ApplicationController respond_to do |format| format.json do - render json: GroupChildrenSerializer + render json: GroupChildSerializer .new(current_user: current_user) .with_pagination(request, response) .represent(@children) |