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

@@ -2550,6 +2550,12 @@ class PostTest < ActiveSupport::TestCase
end
end
context "an aliased tag" do
should "return the count of the consequent tag" do
assert_equal(Post.fast_count("aaa"), Post.fast_count("alias"))
end
end
context "a single metatag" do
should "return the correct cached count" do
FactoryBot.build(:tag, name: "score:42", post_count: -100).save(validate: false)