mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 15:01:14 +00:00
Ignore from search module params sent with empty values (#34615).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@20738 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
252c28fa26
commit
cbac878ee4
@ -63,7 +63,7 @@ class SearchController < ApplicationController
|
|||||||
@object_types = @object_types.select {|o| User.current.allowed_to?("view_#{o}".to_sym, projects_to_search)}
|
@object_types = @object_types.select {|o| User.current.allowed_to?("view_#{o}".to_sym, projects_to_search)}
|
||||||
end
|
end
|
||||||
|
|
||||||
@scope = @object_types.select {|t| params[t]}
|
@scope = @object_types.select {|t| params[t].present?}
|
||||||
@scope = @object_types if @scope.empty?
|
@scope = @object_types if @scope.empty?
|
||||||
|
|
||||||
fetcher = Redmine::Search::Fetcher.new(
|
fetcher = Redmine::Search::Fetcher.new(
|
||||||
|
|||||||
@ -428,4 +428,19 @@ class SearchControllerTest < Redmine::ControllerTest
|
|||||||
assert_select 'dd span.highlight', :text => 'highlighted'
|
assert_select 'dd span.highlight', :text => 'highlighted'
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user