Fix #4584: Disable deleted post filter when searching for status:appealed.

This commit is contained in:
evazion
2020-08-14 22:05:19 -05:00
parent f53fa2adb4
commit c002166801
2 changed files with 14 additions and 1 deletions

View File

@@ -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

View File

@@ -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