summaryrefslogtreecommitdiff
path: root/app/views/search
diff options
context:
space:
mode:
authorMario de la Ossa <mariodelaossa@gmail.com>2019-03-24 21:14:18 -0600
committerMario de la Ossa <mariodelaossa@gmail.com>2019-03-25 15:13:40 -0600
commit0401d00ace8f0efd15131593e89733ebd9add791 (patch)
tree64577563d106eb95be77174a448366b4ff57a20c /app/views/search
parent83153e65a5249fc16c07a54b9db906a4301c76cd (diff)
downloadgitlab-ce-0401d00ace8f0efd15131593e89733ebd9add791.tar.gz
Backport of avoid_n_plus_1_es_load_blobs
Diffstat (limited to 'app/views/search')
-rw-r--r--app/views/search/_results.html.haml2
-rw-r--r--app/views/search/results/_blob.html.haml2
-rw-r--r--app/views/search/results/_wiki_blob.html.haml2
3 files changed, 4 insertions, 2 deletions
diff --git a/app/views/search/_results.html.haml b/app/views/search/_results.html.haml
index 2e62039b90a..5b25a67bc87 100644
--- a/app/views/search/_results.html.haml
+++ b/app/views/search/_results.html.haml
@@ -21,6 +21,8 @@
- if @scope == 'projects'
.term
= render 'shared/projects/list', projects: @search_objects, pipeline_status: false
+ - elsif %w[blobs wiki_blobs].include?(@scope)
+ = render partial: 'search/results/blob', collection: @search_objects, locals: { projects: blob_projects(@search_objects) }
- else
= render partial: "search/results/#{@scope.singularize}", collection: @search_objects
diff --git a/app/views/search/results/_blob.html.haml b/app/views/search/results/_blob.html.haml
index 2a602095845..bdad07f36d1 100644
--- a/app/views/search/results/_blob.html.haml
+++ b/app/views/search/results/_blob.html.haml
@@ -1,4 +1,4 @@
-- project = find_project_for_result_blob(blob)
+- project = find_project_for_result_blob(projects, blob)
- return unless project
- blob = parse_search_result(blob)
diff --git a/app/views/search/results/_wiki_blob.html.haml b/app/views/search/results/_wiki_blob.html.haml
index 389e4cc75b9..b351ecd4edf 100644
--- a/app/views/search/results/_wiki_blob.html.haml
+++ b/app/views/search/results/_wiki_blob.html.haml
@@ -1,4 +1,4 @@
-- project = find_project_for_result_blob(wiki_blob)
+- project = find_project_for_result_blob(projects, wiki_blob)
- wiki_blob = parse_search_result(wiki_blob)
- wiki_blob_link = project_wiki_path(project, wiki_blob.basename)