Fix #4554: Searches with "-status:active" not showing deleted posts.

Also fixes #4542: Quoted search metatag status:"deleted" yields no results.
This commit is contained in:
evazion
2020-08-12 20:50:11 -05:00
parent d884cb6642
commit 78b9613498
3 changed files with 29 additions and 13 deletions

View File

@@ -2,12 +2,12 @@ class PostPresenter
attr_reader :pool, :next_post_in_pool
delegate :tag_list_html, :split_tag_list_html, :split_tag_list_text, :inline_tag_list_html, to: :tag_set_presenter
def self.preview(post, options = {})
def self.preview(post, show_deleted: false, tags: "", **options)
if post.nil?
return "<em>none</em>".html_safe
end
if !options[:show_deleted] && post.is_deleted? && options[:tags] !~ /status:(?:all|any|deleted|banned|modqueue)/
if post.is_deleted? && !show_deleted
return ""
end
@@ -31,8 +31,8 @@ class PostPresenter
locals[:link_target] = options[:link_target] || post
locals[:link_params] = {}
if options[:tags].present? && !CurrentUser.is_anonymous?
locals[:link_params]["q"] = options[:tags]
if tags.present? && !CurrentUser.is_anonymous?
locals[:link_params]["q"] = tags
end
if options[:pool_id]
locals[:link_params]["pool_id"] = options[:pool_id]