summaryrefslogtreecommitdiff
path: root/app/controllers/search_controller.rb
diff options
context:
space:
mode:
authorJan Provaznik <jprovaznik@gitlab.com>2019-03-16 08:19:02 +0100
committerJan Provaznik <jprovaznik@gitlab.com>2019-03-16 08:19:02 +0100
commita68c1cdc38ffe8d4fe21c1bf562c8456c354da7f (patch)
tree40626328888ffa46d3495f2f9dc219d1ee006e88 /app/controllers/search_controller.rb
parentb53376592491cf2016fe68fecaf5f090cf4627b4 (diff)
parent27ac48c394780df923eeb94f3a7f47f6a5f4c649 (diff)
downloadgitlab-ce-users-search-results.tar.gz
Merge branch 'siemens/gitlab-ce-feature/users-search-results' into users-search-resultsusers-search-results
Diffstat (limited to 'app/controllers/search_controller.rb')
-rw-r--r--app/controllers/search_controller.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index 1b22907c10f..90d4bc674d9 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -29,6 +29,7 @@ class SearchController < ApplicationController
@search_objects = search_service.search_objects
render_commits if @scope == 'commits'
+ eager_load_user_status if @scope == 'users'
check_single_commit_result
end
@@ -54,6 +55,12 @@ class SearchController < ApplicationController
@search_objects = prepare_commits_for_rendering(@search_objects)
end
+ def eager_load_user_status
+ return if Feature.disabled?(:users_search, default_enabled: true)
+
+ @search_objects = @search_objects.eager_load(:status) # rubocop:disable CodeReuse/ActiveRecord
+ end
+
def check_single_commit_result
if @search_results.single_commit_result?
only_commit = @search_results.objects('commits').first