Fix #4685: Tagging "aliased_tag -aliased_tag" adds aliased_tag.

This commit is contained in:
evazion
2021-02-03 23:24:12 -06:00
parent e28c28c03b
commit 50864c7147
2 changed files with 11 additions and 1 deletions

View File

@@ -1214,6 +1214,16 @@ class PostTest < ActiveSupport::TestCase
assert_equal("aaa", @post.tag_string)
end
should "resolve aliases before removing negated tags" do
create(:tag_alias, antecedent_name: "female_focus", consequent_name: "female")
@post.update!(tag_string: "blah female_focus -female")
assert_equal("blah", @post.tag_string)
@post.update!(tag_string: "blah female_focus -female_focus")
assert_equal("blah", @post.tag_string)
end
should "resolve abbreviations" do
create(:tag, name: "hair_ribbon", post_count: 300_000)
create(:tag, name: "hakurei_reimu", post_count: 50_000)