Commit 85e058fd authored by Francisco Javier López's avatar Francisco Javier López Committed by Alper Akgun

Use linear version GroupsWithTemplatesFinder#extended_group_search

parent 0f685998
---
name: linear_groups_template_finder_extended_group_search_ancestors_scopes
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/74599
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/345786
milestone: '14.6'
type: development
group: group::access
default_enabled: false
......@@ -18,11 +18,15 @@ class GroupsWithTemplatesFinder
attr_reader :group_id
def extended_group_search
groups = Group.with_project_templates
groups_with_plan = Gitlab::ObjectHierarchy
.new(groups)
.base_and_ancestors
.with_feature_available_in_plan(:group_project_templates)
groups = if Feature.enabled?(:linear_groups_template_finder_extended_group_search_ancestors_scopes, current_group, default_enabled: :yaml)
Group.with_project_templates.self_and_ancestors
else
Gitlab::ObjectHierarchy
.new(Group.with_project_templates)
.base_and_ancestors
end
groups_with_plan = groups.with_feature_available_in_plan(:group_project_templates)
# We're adding an extra query that will be removed once we remove the feature flag in https://gitlab.com/gitlab-org/gitlab/-/issues/339439
if ::Feature.enabled?(:linear_groups_template_finder_extended_group_search, current_group, default_enabled: :yaml)
......
......@@ -106,4 +106,21 @@ RSpec.describe GroupsWithTemplatesFinder, :saas do
it_behaves_like 'group template finder examples'
end
context 'when feature flag :linear_groups_template_finder_extended_group_search_ancestors_scopes is disabled' do
before do
stub_feature_flags(linear_groups_template_finder_extended_group_search_ancestors_scopes: false)
end
it_behaves_like 'group template finder examples'
end
context 'when all linear feature flags are disabled' do
before do
stub_feature_flags(linear_groups_template_finder_extended_group_search: false)
stub_feature_flags(linear_groups_template_finder_extended_group_search_ancestors_scopes: false)
end
it_behaves_like 'group template finder examples'
end
end
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