GitLab steht wegen Wartungsarbeiten am Montag, den 10. Mai, zwischen 17:00 und 19:00 Uhr nicht zur Verfügung.

Commit 17bb105e authored by Stan Hu's avatar Stan Hu Committed by GitLab Release Tools Bot

Merge branch '60906-fix-wiki-links' into 'master'

Use wiki partial in search results

Closes #60906

See merge request gitlab-org/gitlab-ce!27634

(cherry picked from commit f04f6909)

d60d50d6 Use wiki partial in search results
parent ef46f835
......@@ -21,10 +21,9 @@
- if @scope == 'projects'
= 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
- locals = { projects: blob_projects(@search_objects) } if %w[blobs wiki_blobs].include?(@scope)
= render partial: "search/results/#{@scope.singularize}", collection: @search_objects, locals: locals
- if @scope != 'projects'
= paginate_collection(@search_objects)
title: Show proper wiki links in search results
merge_request: 27634
type: fixed
......@@ -9,6 +9,30 @@
context 'uses the right partials depending on scope' do
using RSpec::Parameterized::TableSyntax
set(:project) { create(:project, :public, :repository, :wiki_repo) }
subject { get(:show, params: { project_id:, scope: scope, search: 'merge' }) }
where(:partial, :scope) do
'_blob' | :blobs
'_wiki_blob' | :wiki_blobs
'_commit' | :commits
with_them do
it do
project_wiki = create(:project_wiki, project: project, user: user)
create(:wiki_page, wiki: project_wiki, attrs: { title: 'merge', content: 'merge' })
expect(subject).to render_template("search/results/#{partial}")
it 'finds issue comments' do
project = create(:project, :public)
note = create(:note_on_issue, project: project)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment