Skip to content

Commit

Permalink
Merge pull request #9891 from hennevogel/bugfix/9890
Browse files Browse the repository at this point in the history
Do not throw an error on missing search defaults
  • Loading branch information
vpereira committed Jul 10, 2020
2 parents 1d8d355 + 94cb471 commit 223cb6c
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 53 deletions.
4 changes: 0 additions & 4 deletions src/api/app/controllers/webui/search_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,6 @@ def search
end

logger.debug "Searching for the string \"#{@search_text}\" in the #{@search_where}'s of #{@search_what}'s"
if @search_where.empty? && !@search_attrib_type_id && !@search_issue
flash[:error] = "You have to search for #{@search_text} in something. Click the advanced button..."
return
end

@per_page = 20
search = FullTextSearch.new(text: @search_text,
Expand Down
9 changes: 0 additions & 9 deletions src/api/spec/controllers/webui/search_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,6 @@
end
end

context 'with no search scope' do
before do
get :index, params: { search_text: 'whatever' }
end

it { expect(flash[:error]).to eq('You have to search for whatever in something. Click the advanced button...') }
it { expect(response).to have_http_status(:success) }
end

context 'with proper parameters but no results' do
before do
allow(ThinkingSphinx).to receive(:search).and_return([])
Expand Down
20 changes: 0 additions & 20 deletions src/api/spec/features/beta/webui/search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,26 +133,6 @@
expect(page).to have_selector('#search-results', count: 0)
end

it 'search in no fields' do
apache2

visit search_path
page.evaluate_script('$.fx.off = true;') # Needed to disable javascript animations that can end in not checking the checkboxes properly

fill_in 'search_input', with: 'awesome'
click_button 'Advanced'
uncheck 'title'
uncheck 'name'
uncheck 'description'
click_button 'Search'

within('#flash') do
expect(page).to have_text('You have to search for awesome in something. Click the advanced button...')
end

expect(page).to have_selector('#search-results', count: 0)
end

it 'search Russian project in UTF-8' do
russian_project

Expand Down
20 changes: 0 additions & 20 deletions src/api/spec/features/webui/search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,26 +133,6 @@
expect(page).to have_selector('#search-results', count: 0)
end

it 'search in no fields' do
apache2

visit search_path
page.evaluate_script('$.fx.off = true;') # Needed to disable javascript animations that can end in not checking the checkboxes properly

fill_in 'search_input', with: 'awesome'
click_button 'Advanced'
uncheck 'title'
uncheck 'name'
uncheck 'description'
click_button 'Search'

within('#flash') do
expect(page).to have_text('You have to search for awesome in something. Click the advanced button...')
end

expect(page).to have_selector('#search-results', count: 0)
end

it 'search Russian project in UTF-8' do
russian_project

Expand Down

0 comments on commit 223cb6c

Please sign in to comment.