diff options
Diffstat (limited to 'app/finders/labels_finder.rb')
-rw-r--r-- | app/finders/labels_finder.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/finders/labels_finder.rb b/app/finders/labels_finder.rb index 4358cf249f7..bedd6891d02 100644 --- a/app/finders/labels_finder.rb +++ b/app/finders/labels_finder.rb @@ -100,6 +100,10 @@ class LabelsFinder < UnionFinder strong_memoize(:group_ids) do groups = groups_to_include(group) + # Because we are sure that all groups are in the same hierarchy tree + # we can preset root group for all of them to optimize permission checks + Group.preset_root_ancestor_for(groups) + groups_user_can_read_labels(groups).map(&:id) end end @@ -173,7 +177,7 @@ class LabelsFinder < UnionFinder end if group? - @projects = if params[:include_subgroups] + @projects = if params[:include_descendant_groups] @projects.in_namespace(group.self_and_descendants.select(:id)) else @projects.in_namespace(group.id) |