From c0021668013cd18e6bed8995753607672876fa14 Mon Sep 17 00:00:00 2001 From: evazion Date: Fri, 14 Aug 2020 22:05:19 -0500 Subject: [PATCH] Fix #4584: Disable deleted post filter when searching for status:appealed. --- app/logical/post_query_builder.rb | 3 ++- test/functional/posts_controller_test.rb | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/logical/post_query_builder.rb b/app/logical/post_query_builder.rb index e31a939f1..306663517 100644 --- a/app/logical/post_query_builder.rb +++ b/app/logical/post_query_builder.rb @@ -912,8 +912,9 @@ class PostQueryBuilder metatags end + # XXX unify with PostSets::Post#show_deleted? def hide_deleted? - has_status_metatag = select_metatags(:status).any? { |metatag| metatag.value.downcase.in?(%w[deleted active any all]) } + has_status_metatag = select_metatags(:status).any? { |metatag| metatag.value.downcase.in?(%w[deleted active any all unmoderated modqueue appealed]) } hide_deleted_posts? && !has_status_metatag end end diff --git a/test/functional/posts_controller_test.rb b/test/functional/posts_controller_test.rb index af6eb6360..89431f69d 100644 --- a/test/functional/posts_controller_test.rb +++ b/test/functional/posts_controller_test.rb @@ -373,6 +373,18 @@ class PostsControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_select "#post_#{@post.id}", 1 end + + context "with the hide_deleted_posts option enabled" do + should "show deleted posts when searching for status:appealed" do + @user.update!(hide_deleted_posts: true) + create(:post_appeal, post: @post) + + get_auth posts_path(tags: "status:appealed"), @user + + assert_response :success + assert_select "#post_#{@post.id}", 1 + end + end end context "with restricted posts" do