diff options
author | Nick Thomas <nick@gitlab.com> | 2019-06-12 13:20:33 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-06-13 11:07:55 +0100 |
commit | 06440b12d839c34ab4bf1dffdd0d4f5277901f8a (patch) | |
tree | 2ba7fb47f86b4bee02c0b859794fb3118ed35ce0 | |
parent | 182104422ba9752fd3a7117d6189815ba0cdbfbb (diff) | |
download | gitlab-ce-06440b12d839c34ab4bf1dffdd0d4f5277901f8a.tar.gz |
Revert "Avoid loading objects from DB in ES results"
This reverts commit d9cb907c3e987363065136bafb2156e86bc5de26.
-rw-r--r-- | app/controllers/search_controller.rb | 1 | ||||
-rw-r--r-- | app/models/project_feature.rb | 2 | ||||
-rw-r--r-- | app/services/search_service.rb | 4 | ||||
-rw-r--r-- | app/views/search/_results.html.haml | 2 | ||||
-rw-r--r-- | app/views/search/results/_issue.html.haml | 2 | ||||
-rw-r--r-- | app/views/search/results/_merge_request.html.haml | 2 | ||||
-rw-r--r-- | app/views/search/results/_milestone.html.haml | 2 | ||||
-rw-r--r-- | lib/gitlab/search_results.rb | 4 |
8 files changed, 4 insertions, 15 deletions
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index cb25548c83f..a80ab3bcd28 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -25,7 +25,6 @@ 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' diff --git a/app/models/project_feature.rb b/app/models/project_feature.rb index 6bcb051bff6..0542581c6e0 100644 --- a/app/models/project_feature.rb +++ b/app/models/project_feature.rb @@ -72,8 +72,6 @@ class ProjectFeature < ApplicationRecord default_value_for :wiki_access_level, value: ENABLED, allows_nil: false default_value_for :repository_access_level, value: ENABLED, allows_nil: false - scope :for_project_id, -> (project) { where(project: project) } - def feature_available?(feature, user) # This feature might not be behind a feature flag at all, so default to true return false unless ::Feature.enabled?(feature, user, default_enabled: true) diff --git a/app/services/search_service.rb b/app/services/search_service.rb index 302510341ac..e0cbfac2420 100644 --- a/app/services/search_service.rb +++ b/app/services/search_service.rb @@ -52,10 +52,6 @@ class SearchService @search_objects ||= search_results.objects(scope, params[:page]) end - def display_options - @display_options ||= search_results.display_options(scope) - end - private def search_service diff --git a/app/views/search/_results.html.haml b/app/views/search/_results.html.haml index 12eb8d7fa81..cb8a8a24be8 100644 --- a/app/views/search/_results.html.haml +++ b/app/views/search/_results.html.haml @@ -21,7 +21,7 @@ .search-results - if @scope == 'projects' .term - = render 'shared/projects/list', { projects: @search_objects, pipeline_status: false }.merge(@display_options) + = render 'shared/projects/list', projects: @search_objects, pipeline_status: false - else - locals = { projects: blob_projects(@search_objects) } if %w[blobs wiki_blobs].include?(@scope) = render partial: "search/results/#{@scope.singularize}", collection: @search_objects, locals: locals diff --git a/app/views/search/results/_issue.html.haml b/app/views/search/results/_issue.html.haml index 1f055cdfa31..796782035f2 100644 --- a/app/views/search/results/_issue.html.haml +++ b/app/views/search/results/_issue.html.haml @@ -1,7 +1,7 @@ .search-result-row %h4 = confidential_icon(issue) - = link_to namespace_project_issue_path(issue.project.namespace.becomes(Namespace), issue.project, issue) do + = link_to [issue.project.namespace.becomes(Namespace), issue.project, issue] do %span.term.str-truncated= issue.title - if issue.closed? %span.badge.badge-danger.prepend-left-5= _("Closed") diff --git a/app/views/search/results/_merge_request.html.haml b/app/views/search/results/_merge_request.html.haml index 074bb9bce8d..f0e0af11f27 100644 --- a/app/views/search/results/_merge_request.html.haml +++ b/app/views/search/results/_merge_request.html.haml @@ -1,6 +1,6 @@ .search-result-row %h4 - = link_to namespace_project_merge_request_path(merge_request.target_project.namespace.becomes(Namespace), merge_request.target_project, merge_request) do + = link_to [merge_request.target_project.namespace.becomes(Namespace), merge_request.target_project, merge_request] do %span.term.str-truncated= merge_request.title - if merge_request.merged? %span.badge.badge-primary.prepend-left-5= _("Merged") diff --git a/app/views/search/results/_milestone.html.haml b/app/views/search/results/_milestone.html.haml index 3201f1a7815..2daa96e34d1 100644 --- a/app/views/search/results/_milestone.html.haml +++ b/app/views/search/results/_milestone.html.haml @@ -1,6 +1,6 @@ .search-result-row %h4 - = link_to namespace_project_milestone_path(milestone.project.namespace.becomes(Namespace), milestone.project, milestone) do + = link_to [milestone.project.namespace.becomes(Namespace), milestone.project, milestone] do %span.term.str-truncated= milestone.title - if milestone.description.present? diff --git a/lib/gitlab/search_results.rb b/lib/gitlab/search_results.rb index 3daa03d01d6..7c1e6b1baff 100644 --- a/lib/gitlab/search_results.rb +++ b/lib/gitlab/search_results.rb @@ -85,10 +85,6 @@ module Gitlab UsersFinder.new(current_user, search: query).execute end - def display_options(_scope) - {} - end - private def projects |