diff --git a/app/logical/post_sets/post.rb b/app/logical/post_sets/post.rb index 30d76717e..79585110b 100644 --- a/app/logical/post_sets/post.rb +++ b/app/logical/post_sets/post.rb @@ -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 diff --git a/test/functional/posts_controller_test.rb b/test/functional/posts_controller_test.rb index 173798edd..41bdc1c88 100644 --- a/test/functional/posts_controller_test.rb +++ b/test/functional/posts_controller_test.rb @@ -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