diff options
author | randx <dmitriy.zaporozhets@gmail.com> | 2012-10-09 22:09:46 +0300 |
---|---|---|
committer | randx <dmitriy.zaporozhets@gmail.com> | 2012-10-09 22:09:46 +0300 |
commit | 679d0d6d760b850e27c13f3ce0f812b8b081df7f (patch) | |
tree | e3f088a9139d693e96fd2bd86264150f0d96270c /app/controllers/search_controller.rb | |
parent | 63fe042d97a5430770ec50fc0e8f29c416bd2ec9 (diff) | |
download | gitlab-ce-679d0d6d760b850e27c13f3ce0f812b8b081df7f.tar.gz |
Context refactoring. Move Issues list, Search logic to context
Diffstat (limited to 'app/controllers/search_controller.rb')
-rw-r--r-- | app/controllers/search_controller.rb | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 71e2d92b2b2..1dc8507e019 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -1,15 +1,9 @@ class SearchController < ApplicationController def show - query = params[:search] + result = SearchContext.new(current_user.project_ids, params).execute - @projects = [] - @merge_requests = [] - @issues = [] - - if query.present? - @projects = current_user.projects.search(query).limit(10) - @merge_requests = MergeRequest.where(project_id: current_user.project_ids).search(query).limit(10) - @issues = Issue.where(project_id: current_user.project_ids).search(query).limit(10) - end + @projects = result[:projects] + @merge_requests = result[:merge_requests] + @issues = result[:issues] end end |