diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-08 00:15:00 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-08 00:15:00 +0000 |
commit | 1b7a8ceadb5f0facee1b2ba9f7e4c8475b7e6f9b (patch) | |
tree | b90e7731456e740e563a4cf796f7374904147537 /app/finders | |
parent | eab843a2f5a48b5b2bb682adf3df6d054850e4b7 (diff) | |
download | gitlab-ce-1b7a8ceadb5f0facee1b2ba9f7e4c8475b7e6f9b.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/groups_finder.rb | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/app/finders/groups_finder.rb b/app/finders/groups_finder.rb index 7ea3362fba1..7e3cdd79a4c 100644 --- a/app/finders/groups_finder.rb +++ b/app/finders/groups_finder.rb @@ -52,7 +52,16 @@ class GroupsFinder < UnionFinder return [Group.all] if current_user&.can_read_all_resources? && all_available? groups = [] - groups << Gitlab::ObjectHierarchy.new(groups_for_ancestors, groups_for_descendants).all_objects if current_user + + if current_user + if Feature.enabled?(:use_traversal_ids_groups_finder, default_enabled: :yaml) + groups << current_user.authorized_groups.self_and_ancestors + groups << current_user.groups.self_and_descendants + else + groups << Gitlab::ObjectHierarchy.new(groups_for_ancestors, groups_for_descendants).all_objects + end + end + groups << Group.unscoped.public_to_user(current_user) if include_public_groups? groups << Group.none if groups.empty? groups @@ -72,9 +81,13 @@ class GroupsFinder < UnionFinder .groups .where('members.access_level >= ?', params[:min_access_level]) - Gitlab::ObjectHierarchy - .new(groups) - .base_and_descendants + if Feature.enabled?(:use_traversal_ids_groups_finder, default_enabled: :yaml) + groups.self_and_descendants + else + Gitlab::ObjectHierarchy + .new(groups) + .base_and_descendants + end end # rubocop: enable CodeReuse/ActiveRecord |