Commit 947509ff authored by Ash McKenzie's avatar Ash McKenzie

Merge branch 'remove-switch-to-basic-search-link' into 'master'

Remove switch to basic search link

See merge request gitlab-org/gitlab!43236
parents 58a79089 a3c4361b
......@@ -2,7 +2,6 @@
= render partial: "search/results/filters"
= render partial: "search/results/empty"
= render_if_exists 'shared/promotions/promote_advanced_search'
= render_if_exists 'search/form_revert_to_basic'
- else
.row-content-block.d-md-flex.text-left.align-items-center
- unless @search_objects.is_a?(Kaminari::PaginatableWithoutCount)
......
......@@ -60,23 +60,6 @@ module EE
Truncato.truncate(search_highlight[issue.id].description.first, count_tags: false, count_tail: false, max_length: 200).html_safe
end
def revert_to_basic_search_filter_url
search_params = params
.permit(::SearchHelper::SEARCH_PERMITTED_PARAMS)
.merge(basic_search: true)
search_path(search_params)
end
def show_switch_to_basic_search?(search_service)
return false unless ::Feature.enabled?(:switch_to_basic_search, default_enabled: false)
return false unless search_service.use_elasticsearch?
return true if @project
search_service.scope.in?(SWITCH_TO_BASIC_SEARCHABLE_TABS)
end
private
def search_multiple_assignees?(type)
......
- if show_switch_to_basic_search?(search_service)
- begin_link = '<a href="%{url}">'.html_safe % { url: revert_to_basic_search_filter_url }
- end_link = '</a>'.html_safe
%p.text-center
= _('You can try again using %{begin_link}basic search%{end_link}').html_safe % { begin_link: begin_link, end_link: end_link }
---
name: switch_to_basic_search
introduced_by_url:
rollout_issue_url:
group:
type: development
default_enabled: false
......@@ -230,39 +230,6 @@ RSpec.describe 'Global elastic search', :elastic, :sidekiq_inline do
expect(page).to have_content('Users 0')
end
end
context 'when no results are returned' do
it 'allows basic search without Elasticsearch' do
visit dashboard_projects_path
# Disable sidekiq to ensure it does not end up in the index
Sidekiq::Testing.disable! do
create(:project, namespace: user.namespace, name: 'Will not be found but searchable')
end
submit_search('searchable')
expect(page).not_to have_content('Will not be found')
# Since there are no results you have the option to instead use basic
# search
click_link 'basic search'
# Project is found now that we are using basic search
expect(page).to have_content('Will not be found')
end
context 'when performing Commits search' do
it 'does not allow basic search' do
visit dashboard_projects_path
submit_search('project')
select_search_scope('Commits')
expect(page).not_to have_link('basic search')
end
end
end
end
RSpec.describe 'Global elastic search redactions', :elastic do
......
......@@ -121,48 +121,4 @@ RSpec.describe SearchHelper do
it_behaves_like 'returns old message'
end
end
describe '#show_switch_to_basic_search?' do
let(:use_elasticsearch) { true }
let(:scope) { 'commits' }
let(:search_service) { instance_double(Search::GlobalService, use_elasticsearch?: use_elasticsearch, scope: scope) }
subject { show_switch_to_basic_search?(search_service) }
before do
stub_feature_flags(switch_to_basic_search: true)
end
context 'when :switch_to_basic_search feature is disabled' do
before do
stub_feature_flags(switch_to_basic_search: false)
end
it { is_expected.to eq(false) }
end
context 'when not currently using elasticsearch' do
let(:use_elasticsearch) { false }
it { is_expected.to eq(false) }
end
context 'when project scope' do
before do
@project = create(:project)
end
it { is_expected.to eq(true) }
end
context 'when commits tab' do
it { is_expected.to eq(false) }
end
context 'when issues tab' do
let(:scope) { 'issues' }
it { is_expected.to eq(true) }
end
end
end
......@@ -29195,9 +29195,6 @@ msgstr ""
msgid "You can test your .gitlab-ci.yml in %{linkStart}CI Lint%{linkEnd}."
msgstr ""
msgid "You can try again using %{begin_link}basic search%{end_link}"
msgstr ""
msgid "You cannot access the raw file. Please wait a minute."
msgstr ""
......
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