Skip to content

Only trigger search if search string is present

This is a follow up for !296 (merged) to prevent the search function from being executed while the query is nil.

Problem was this: When the search is called, the search controller gets 2 requests.

{"action"=>"show", "controller"=>"search"}

and

{"utf8"=>"✓",
 "search"=>"proj",
 "project_id"=>"",
 "group_id"=>"",
 "snippets"=>"",
 "scope"=>"",
 "button"=>"",
 "action"=>"show",
 "controller"=>"search"}

Obviously it doesn't make sense to execute the search for the first request, since that one doesn't have a scope or a search string.

Please review this carefully since this modifies the search and may break things i can't think of.

@dzaporozhets While this fixes the root cause for the failing test, I think we should keep your fix in as a failsafe. What do you think of this?

Merge request reports