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

@@ -392,7 +392,6 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase
should "move the *_(cosplay) tag as well" do
@post = create(:post, tag_string: "toosaka_rin_(cosplay)")
@wiki = create(:wiki_page, title: "toosaka_rin_(cosplay)")
@ta = create(:tag_alias, antecedent_name: "toosaka_rin", consequent_name: "tohsaka_rin")
create_bur!("rename toosaka_rin -> tohsaka_rin", @admin)
@@ -401,6 +400,18 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase
end
end
context "when aliasing a character tag with a *_(cosplay) tag" do
should "move the *_(cosplay) tag as well" do
@post = create(:post, tag_string: "toosaka_rin_(cosplay)")
@wiki = create(:wiki_page, title: "toosaka_rin_(cosplay)")
create_bur!("alias toosaka_rin -> tohsaka_rin", @admin)
assert_equal("cosplay tohsaka_rin tohsaka_rin_(cosplay)", @post.reload.tag_string)
assert_equal("tohsaka_rin_(cosplay)", @wiki.reload.title)
end
end
context "when renaming an artist tag with a *_(style) tag" do
should "move the *_(style) tag as well" do
create(:tag, name: "tanaka_takayuki", category: Tag.categories.artist)