Use linear versions of descendants in GroupDescendantsFinder

parent adddc040
...@@ -87,9 +87,13 @@ class GroupDescendantsFinder ...@@ -87,9 +87,13 @@ class GroupDescendantsFinder
visible_to_user = visible_to_user.or(authorized_to_user) visible_to_user = visible_to_user.or(authorized_to_user)
end end
hierarchy_for_parent group_to_query = if Feature.enabled?(:linear_group_descendants_finder, current_user, default_enabled: :yaml)
.descendants parent_group
.where(visible_to_user) else
hierarchy_for_parent
end
group_to_query.descendants.where(visible_to_user)
# rubocop: enable CodeReuse/Finder # rubocop: enable CodeReuse/Finder
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
...@@ -155,7 +159,13 @@ class GroupDescendantsFinder ...@@ -155,7 +159,13 @@ class GroupDescendantsFinder
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def projects_matching_filter def projects_matching_filter
# rubocop: disable CodeReuse/Finder # rubocop: disable CodeReuse/Finder
projects_nested_in_group = Project.where(namespace_id: hierarchy_for_parent.base_and_descendants.select(:id)) objects_in_hierarchy = if Feature.enabled?(:linear_group_descendants_finder, current_user, default_enabled: :yaml)
parent_group.self_and_descendants.as_ids
else
hierarchy_for_parent.base_and_descendants.select(:id)
end
projects_nested_in_group = Project.where(namespace_id: objects_in_hierarchy)
params_with_search = params.merge(search: params[:filter]) params_with_search = params.merge(search: params[:filter])
ProjectsFinder.new(params: params_with_search, ProjectsFinder.new(params: params_with_search,
......
---
name: linear_group_descendants_finder
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68954
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/339440
milestone: '14.6'
type: development
group: group::access
default_enabled: false
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment