tags: don't allow aliases inside *_(cosplay) tags.

Don't treat *_(cosplay) tags as being invisibly aliased when a character tag is aliased. For example,
if toosaka_rin is aliased to tohsaka_rin, and toosaka_rin_(cosplay) is later added to a post, don't
magically translate the tag to tohsaka_rin_(cosplay). Instead, treat it as an error to create a
*_(cosplay) tag for an aliased character tag.

This removes some of the complexity and magic behavior surrounding *_(cosplay) tags.
This commit is contained in:
evazion
2022-04-30 18:00:19 -05:00
parent f8aa985a16
commit 0920d2ca24
6 changed files with 27 additions and 16 deletions

View File

@@ -577,7 +577,11 @@ class PostTest < ActiveSupport::TestCase
@post.add_tag("jim_(cosplay)")
@post.save
assert(@post.has_tag?("james"), "expected 'jim' to be aliased to 'james'")
assert_equal(false, @post.has_tag?("jim_(cosplay)"))
assert_equal(false, @post.has_tag?("james_(cosplay)"))
assert_equal(false, @post.has_tag?("jim"))
assert_equal(false, @post.has_tag?("james"))
assert_match(/'jim_\(cosplay\)' is not allowed because 'jim' is aliased to 'james'/, @post.warnings.full_messages.join)
end
should "apply implications after the character tag is added" do
@@ -1213,6 +1217,7 @@ class PostTest < ActiveSupport::TestCase
refute(@post.has_tag?("little_red_riding_hood"))
refute(@post.has_tag?("cosplay"))
assert(@post.warnings[:base].grep(/Couldn't add tag/).present?)
assert_match(/'little_red_riding_hood_\(cosplay\)' is not allowed because 'little_red_riding_hood' is not a character tag/, @post.warnings.full_messages.join)
end
should "allow creating a _(cosplay) tag for an empty general tag" do