Commit f2c70d82 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '20444-remove-feature-flag' into 'master'

Remove project_search_by_full_path feature flag

See merge request gitlab-org/gitlab!29448
parents e0a9eb64 a8068ea6
......@@ -591,7 +591,7 @@ class Project < ApplicationRecord
#
# query - The search query as a String.
def search(query, include_namespace: false)
if include_namespace && Feature.enabled?(:project_search_by_full_path, default_enabled: true)
if include_namespace
joins(:route).fuzzy_search(query, [Route.arel_table[:path], Route.arel_table[:name], :description])
else
fuzzy_search(query, [:path, :name, :description])
......
......@@ -1740,32 +1740,12 @@ describe Project do
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, group: group) }
context 'when feature is enabled' do
before do
stub_feature_flags(project_search_by_full_path: true)
end
it 'returns projects that match the group path' do
expect(described_class.search(group.path, include_namespace: true)).to eq([project])
end
it 'returns projects that match the full path' do
expect(described_class.search(project.full_path, include_namespace: true)).to eq([project])
end
it 'returns projects that match the group path' do
expect(described_class.search(group.path, include_namespace: true)).to eq([project])
end
context 'when feature is disabled' do
before do
stub_feature_flags(project_search_by_full_path: false)
end
it 'returns no results when searching by group path' do
expect(described_class.search(group.path, include_namespace: true)).to be_empty
end
it 'returns no results when searching by full path' do
expect(described_class.search(project.full_path, include_namespace: true)).to be_empty
end
it 'returns projects that match the full path' do
expect(described_class.search(project.full_path, include_namespace: true)).to eq([project])
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