Fix #4508: Specific tag not showing a wiki.
Fix the wiki excerpt not appearing when searching for a tag that doesn't exist in the tag list. This could happen if someone created a wiki for a tag that has never been used on a post.
This commit is contained in:
@@ -24,9 +24,8 @@ module PostSets
|
||||
end
|
||||
|
||||
def wiki_page
|
||||
return nil unless tag.present? && tag.wiki_page.present?
|
||||
return nil unless !tag.wiki_page.is_deleted?
|
||||
tag.wiki_page
|
||||
return nil unless normalized_query.has_single_tag?
|
||||
@wiki_page ||= WikiPage.undeleted.find_by(title: normalized_query.tags.first.name)
|
||||
end
|
||||
|
||||
def tag
|
||||
|
||||
@@ -96,6 +96,13 @@ class PostsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
should "show the wiki excerpt for a wiki page without a tag" do
|
||||
as(@user) { create(:wiki_page, title: "no_tag") }
|
||||
get posts_path(tags: "no_tag")
|
||||
assert_select "#show-excerpt-link", count: 1
|
||||
assert_select "#excerpt", count: 1
|
||||
end
|
||||
|
||||
should "show a notice for a single tag search with a pending BUR" do
|
||||
create(:bulk_update_request, script: "create alias foo -> bar")
|
||||
get_auth posts_path(tags: "foo"), @user
|
||||
|
||||
Reference in New Issue
Block a user