Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-12-17 14:59:07 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-12-17 14:59:07 +0300
commit8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch)
tree544930fb309b30317ae9797a9683768705d664c4 /app/controllers/search_controller.rb
parent4b1de649d0168371549608993deac953eb692019 (diff)
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'app/controllers/search_controller.rb')
-rw-r--r--app/controllers/search_controller.rb34
1 files changed, 6 insertions, 28 deletions
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index c92b3457640..196b1887ca7 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -3,16 +3,8 @@
class SearchController < ApplicationController
include ControllerWithCrossProjectAccessCheck
include SearchHelper
- include RendersCommits
include RedisTracking
- SCOPE_PRELOAD_METHOD = {
- projects: :with_web_entity_associations,
- issues: :with_web_entity_associations,
- merge_requests: :with_web_entity_associations,
- epics: :with_web_entity_associations
- }.freeze
-
track_redis_hll_event :show, name: 'i_search_total', feature: :search_track_unique_users, feature_default_enabled: true
around_action :allow_gitaly_ref_name_caching
@@ -41,14 +33,12 @@ class SearchController < ApplicationController
@search_term = params[:search]
@sort = params[:sort] || default_sort
- @scope = search_service.scope
- @show_snippets = search_service.show_snippets?
- @search_results = search_service.search_results
- @search_objects = search_service.search_objects(preload_method)
- @search_highlight = search_service.search_highlight
-
- render_commits if @scope == 'commits'
- eager_load_user_status if @scope == 'users'
+ @search_service = Gitlab::View::Presenter::Factory.new(search_service, current_user: current_user).fabricate!
+ @scope = @search_service.scope
+ @show_snippets = @search_service.show_snippets?
+ @search_results = @search_service.search_results
+ @search_objects = @search_service.search_objects
+ @search_highlight = @search_service.search_highlight
increment_search_counters
end
@@ -79,10 +69,6 @@ class SearchController < ApplicationController
private
- def preload_method
- SCOPE_PRELOAD_METHOD[@scope.to_sym]
- end
-
# overridden in EE
def default_sort
'created_desc'
@@ -102,14 +88,6 @@ class SearchController < ApplicationController
true
end
- def render_commits
- @search_objects = prepare_commits_for_rendering(@search_objects)
- end
-
- def eager_load_user_status
- @search_objects = @search_objects.eager_load(:status) # rubocop:disable CodeReuse/ActiveRecord
- end
-
def check_single_commit_result?
return false if params[:force_search_results]
return false unless @project.present?