diff options
author | Sean McGivern <sean@gitlab.com> | 2019-03-19 10:30:08 +0000 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-03-19 10:30:08 +0000 |
commit | 47859bb491e74fabc19715b89679056ece5ea3de (patch) | |
tree | 402e4e125c3bcd30795d481a21b52109b993628c /app/controllers | |
parent | e13f2ff6368d15b99715a33ed7f4a9254d784d48 (diff) | |
parent | 27ac48c394780df923eeb94f3a7f47f6a5f4c649 (diff) | |
download | gitlab-ce-47859bb491e74fabc19715b89679056ece5ea3de.tar.gz |
Merge branch 'feature/users-search-results' into 'master'
Add users search results to global search
Closes #25973
See merge request gitlab-org/gitlab-ce!21197
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/search_controller.rb | 7 |
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 |