summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/search_controller.rb2
-rw-r--r--test/functional/search_controller_test.rb15
2 files changed, 16 insertions, 1 deletions
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index d6bb2dd94..1a4a12fcc 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -63,7 +63,7 @@ class SearchController < ApplicationController
@object_types = @object_types.select {|o| User.current.allowed_to?("view_#{o}".to_sym, projects_to_search)}
end
- @scope = @object_types.select {|t| params[t]}
+ @scope = @object_types.select {|t| params[t].present?}
@scope = @object_types if @scope.empty?
fetcher = Redmine::Search::Fetcher.new(
diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb
index 24468eaa1..c31abb52b 100644
--- a/test/functional/search_controller_test.rb
+++ b/test/functional/search_controller_test.rb
@@ -428,4 +428,19 @@ class SearchControllerTest < Redmine::ControllerTest
assert_select 'dd span.highlight', :text => 'highlighted'
end
end
+
+ def test_search_should_exclude_empty_modules_params
+ @request.session[:user_id] = 1
+
+ get :index, params: {
+ q: "private",
+ scope: "all",
+ issues: "1",
+ projects: nil
+ }
+
+ assert_response :success
+
+ assert_select '#search-results dt.project', 0
+ end
end