Commit 62533dd1 authored by Francisco Javier López's avatar Francisco Javier López Committed by Vitali Tatarintev

Use linear version GroupsWithTemplatesFinder#extended_group_search

parent f2c6c39a
---
name: linear_groups_template_finder_extended_group_search
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68936
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/339439
milestone: '14.3'
type: development
group: group::access
default_enabled: false
...@@ -18,6 +18,7 @@ class GroupsWithTemplatesFinder ...@@ -18,6 +18,7 @@ class GroupsWithTemplatesFinder
attr_reader :group_id attr_reader :group_id
def extended_group_search def extended_group_search
# 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
groups = if Feature.enabled?(:linear_groups_template_finder_extended_group_search_ancestors_scopes, current_group, default_enabled: :yaml) 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 Group.with_project_templates.self_and_ancestors
else else
...@@ -26,14 +27,7 @@ class GroupsWithTemplatesFinder ...@@ -26,14 +27,7 @@ class GroupsWithTemplatesFinder
.base_and_ancestors .base_and_ancestors
end end
groups_with_plan = groups.with_feature_available_in_plan(:group_project_templates) groups.with_feature_available_in_plan(:group_project_templates).self_and_descendants
# 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)
groups_with_plan.self_and_descendants
else
Gitlab::ObjectHierarchy.new(groups_with_plan).base_and_descendants
end
end end
def simple_group_search(groups) def simple_group_search(groups)
......
...@@ -99,14 +99,6 @@ RSpec.describe GroupsWithTemplatesFinder, :saas do ...@@ -99,14 +99,6 @@ RSpec.describe GroupsWithTemplatesFinder, :saas do
it_behaves_like 'group template finder examples' it_behaves_like 'group template finder examples'
context 'when feature flag :linear_groups_template_finder_extended_group_search is disabled' do
before do
stub_feature_flags(linear_groups_template_finder_extended_group_search: false)
end
it_behaves_like 'group template finder examples'
end
context 'when feature flag :linear_groups_template_finder_extended_group_search_ancestors_scopes is disabled' do context 'when feature flag :linear_groups_template_finder_extended_group_search_ancestors_scopes is disabled' do
before do before do
stub_feature_flags(linear_groups_template_finder_extended_group_search_ancestors_scopes: false) stub_feature_flags(linear_groups_template_finder_extended_group_search_ancestors_scopes: false)
...@@ -114,13 +106,4 @@ RSpec.describe GroupsWithTemplatesFinder, :saas do ...@@ -114,13 +106,4 @@ RSpec.describe GroupsWithTemplatesFinder, :saas do
it_behaves_like 'group template finder examples' it_behaves_like 'group template finder examples'
end 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 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