Post.fast_count: fix incorrect counts for aliased tags.

Revert optimization from a6163258b. Turns out that we have to resolve
aliases in fast_count, otherwise for aliased tags we'll return an empty
count.

Fixes #4156.
This commit is contained in:
evazion
2019-09-04 23:56:12 -05:00
parent 59d92b448e
commit 416f817f6d
3 changed files with 15 additions and 1 deletions

View File

@@ -1115,7 +1115,7 @@ class Post < ApplicationRecord
tags = tags.to_s
tags += " rating:s" if CurrentUser.safe_mode?
tags += " -status:deleted" if CurrentUser.hide_deleted_posts? && !Tag.has_metatag?(tags, "status", "-status")
tags = Tag.normalize_query(tags, normalize_aliases: false)
tags = Tag.normalize_query(tags)
# optimize some cases. these are just estimates but at these
# quantities being off by a few hundred doesn't matter much