Additional tests for SearchController and handle my_projects scope without memberships.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8266 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2011-12-17 18:23:53 +00:00
parent 199eaff14e
commit bb0cd34f4e
2 changed files with 45 additions and 0 deletions

View File

@@ -62,6 +62,11 @@ module Redmine
# projects argument can be either nil (will search all projects), a project or an array of projects
# Returns the results and the results count
def search(tokens, projects=nil, options={})
if projects.is_a?(Array) && projects.empty?
# no results
return [[], 0]
end
# TODO: make user an argument
user = User.current
tokens = [] << tokens unless tokens.is_a?(Array)