Defect #34615 » 0001-Ignore-from-search-module-params-sent-with-empty-val.patch
| app/controllers/search_controller.rb | ||
|---|---|---|
| 63 | 63 |       @object_types = @object_types.select {|o| User.current.allowed_to?("view_#{o}".to_sym, projects_to_search)} | 
| 64 | 64 | end | 
| 65 | 65 | |
| 66 |     @scope = @object_types.select {|t| params[t]} | |
| 66 |     @scope = @object_types.select {|t| params[t].present?} | |
| 67 | 67 | @scope = @object_types if @scope.empty? | 
| 68 | 68 | |
| 69 | 69 | fetcher = Redmine::Search::Fetcher.new( | 
| test/functional/search_controller_test.rb | ||
|---|---|---|
| 428 | 428 | assert_select 'dd span.highlight', :text => 'highlighted' | 
| 429 | 429 | end | 
| 430 | 430 | end | 
| 431 | ||
| 432 | def test_search_should_exclude_empty_modules_params | |
| 433 | @request.session[:user_id] = 1 | |
| 434 | ||
| 435 |     get :index, params: { | |
| 436 | q: "private", | |
| 437 | scope: "all", | |
| 438 | issues: "1", | |
| 439 | projects: nil | |
| 440 | } | |
| 441 | ||
| 442 | assert_response :success | |
| 443 | ||
| 444 | assert_select '#search-results dt.project', 0 | |
| 445 | end | |
| 431 | 446 | end |