diff options
Diffstat (limited to 'app/controllers/search_controller.rb')
-rw-r--r-- | app/controllers/search_controller.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 1b22907c10f..cb25548c83f 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -14,8 +14,6 @@ class SearchController < ApplicationController layout 'search' def show - search_service = SearchService.new(current_user, params) - @project = search_service.project @group = search_service.group @@ -27,8 +25,10 @@ class SearchController < ApplicationController @show_snippets = search_service.show_snippets? @search_results = search_service.search_results @search_objects = search_service.search_objects + @display_options = search_service.display_options render_commits if @scope == 'commits' + eager_load_user_status if @scope == 'users' check_single_commit_result end @@ -54,6 +54,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 |