diff options
Diffstat (limited to 'app/finders/labels_finder.rb')
-rw-r--r-- | app/finders/labels_finder.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/finders/labels_finder.rb b/app/finders/labels_finder.rb index 4358cf249f7..f14ae37fcfe 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) if Feature.enabled?(:preset_root_ancestor_for_labels, group) + groups_user_can_read_labels(groups).map(&:id) end end |