Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-09-05 17:57:46 +0300
committerBob Van Landuyt <bob@vanlanduyt.co>2017-10-04 23:46:49 +0300
commit80780018a931ce41047ab62ed7dd6c5f1e28f08b (patch)
tree2025c03c20806078d8cd0006a4b1084f53b0630a /app/controllers/groups_controller.rb
parent648c082a23f51bdf7151b6c5f716e74c4fe6a5bd (diff)
Update `children` route to handle projects and groups
Diffstat (limited to 'app/controllers/groups_controller.rb')
-rw-r--r--app/controllers/groups_controller.rb8
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)