Fix #3410: Unable to create a new wiki page.

Fix `Post.fast_count(nil)` failing when the user had the "safe mode" or
"deleted post filter" options turned on.
This commit is contained in:
evazion
2017-11-29 12:26:32 -06:00
parent 4939c0345a
commit 3c6a613964
2 changed files with 7 additions and 2 deletions

View File

@@ -1136,6 +1136,7 @@ class Post < ApplicationRecord
module CountMethods
def fast_count(tags = "", options = {})
tags = tags.to_s
tags += " rating:s" if CurrentUser.safe_mode?
tags += " -status:deleted" if CurrentUser.hide_deleted_posts? && tags !~ /(?:^|\s)(?:-)?status:.+/
tags = Tag.normalize_query(tags)