diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-09-13 10:25:37 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-10-04 22:49:41 +0200 |
commit | 1fb49b8729b126360e9852b184c0ba63c330c4b5 (patch) | |
tree | 16d98d3cebce15491fc8d78059bb6b1dd4fe0ccd /app | |
parent | 3299a970e09ceca7ecabb3d78a5693f58ef79d79 (diff) | |
download | gitlab-ce-1fb49b8729b126360e9852b184c0ba63c330c4b5.tar.gz |
Only show root groups on the dashboard
The children are lazy-loaded when expanding
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/dashboard/groups_controller.rb | 16 | ||||
-rw-r--r-- | app/finders/group_children_finder.rb | 1 |
2 files changed, 3 insertions, 14 deletions
diff --git a/app/controllers/dashboard/groups_controller.rb b/app/controllers/dashboard/groups_controller.rb index 600ef890f39..d14427cd7a7 100644 --- a/app/controllers/dashboard/groups_controller.rb +++ b/app/controllers/dashboard/groups_controller.rb @@ -2,19 +2,9 @@ class Dashboard::GroupsController < Dashboard::ApplicationController def index @sort = params[:sort] || 'id_desc' - @groups = - if params[:parent_id] && Group.supports_nested_groups? - parent = Group.find_by(id: params[:parent_id]) - - if can?(current_user, :read_group, parent) - GroupsFinder.new(current_user, parent: parent).execute - else - Group.none - end - else - current_user.groups - end - + @groups = GroupsFinder.new(current_user, all_available: false).execute + # 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? @groups = @groups.includes(:route) @groups = @groups.sort(@sort) diff --git a/app/finders/group_children_finder.rb b/app/finders/group_children_finder.rb index 9760f9ef802..6e2e2dfa5a1 100644 --- a/app/finders/group_children_finder.rb +++ b/app/finders/group_children_finder.rb @@ -64,7 +64,6 @@ class GroupChildrenFinder else base_groups end - groups = groups groups.sort(params[:sort]).includes(:route) end |