Fix links to wiki pages with subdirectories
This commit contains the patch suggested by @fjsanpedro in the issue covering broken links in wiki search results. Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/56234
This commit is contained in:
parent
33d5ec5b56
commit
2f36efa087
|
@ -1,5 +1,5 @@
|
|||
- 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)
|
||||
- wiki_blob_link = project_wiki_path(project, Pathname.new(wiki_blob.filename).sub_ext(''))
|
||||
|
||||
= render partial: 'search/results/blob_data', locals: { blob: wiki_blob, project: project, file_name: wiki_blob.filename, blob_link: wiki_blob_link }
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: fix wiki search result links in titles
|
||||
merge_request: 27400
|
||||
author: khm
|
||||
type: fixed
|
|
@ -14,22 +14,36 @@ describe 'User searches for wiki pages', :js do
|
|||
|
||||
include_examples 'top right search form'
|
||||
|
||||
it 'finds a page' do
|
||||
find('.js-search-project-dropdown').click
|
||||
shared_examples 'search wiki blobs' do
|
||||
it 'finds a page' do
|
||||
find('.js-search-project-dropdown').click
|
||||
|
||||
page.within('.project-filter') do
|
||||
click_link(project.full_name)
|
||||
page.within('.project-filter') do
|
||||
click_link(project.full_name)
|
||||
end
|
||||
|
||||
fill_in('dashboard_search', with: 'content')
|
||||
find('.btn-search').click
|
||||
|
||||
page.within('.search-filter') do
|
||||
click_link('Wiki')
|
||||
end
|
||||
|
||||
page.within('.results') do
|
||||
expect(find(:css, '.search-results')).to have_link(wiki_page.title, href: project_wiki_path(project, wiki_page.slug))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
fill_in('dashboard_search', with: 'content')
|
||||
find('.btn-search').click
|
||||
|
||||
page.within('.search-filter') do
|
||||
click_link('Wiki')
|
||||
context 'when searching by content' do
|
||||
it_behaves_like 'search wiki blobs' do
|
||||
let(:search_term) { 'content' }
|
||||
end
|
||||
end
|
||||
|
||||
page.within('.results') do
|
||||
expect(find(:css, '.search-results')).to have_link(wiki_page.title)
|
||||
context 'when searching by title' do
|
||||
it_behaves_like 'search wiki blobs' do
|
||||
let(:search_term) { 'test_wiki' }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue