posts: fix bug preventing *_(cosplay) tags from being added.
Bug: if `hatsune_miku` is an empty general tag, then tagging a post with `hatsune_miku_(cosplay)` would fail because `hatsune_miku` wasn't a character tag. This could cause tagging posts to fail when aliasing a character tag back to an old name that was used in the past, but was now an empty general tag. Fix: only treat the *_(cosplay) tag as being in conflict with the base tag when the base tag is nonempty.
This commit is contained in:
@@ -1296,6 +1296,14 @@ class PostTest < ActiveSupport::TestCase
|
||||
refute(@post.has_tag?("cosplay"))
|
||||
assert(@post.warnings[:base].grep(/Couldn't add tag/).present?)
|
||||
end
|
||||
|
||||
should "allow creating a _(cosplay) tag for an empty general tag" do
|
||||
@tag = create(:tag, name: "hatsune_miku", post_count: 0, category: Tag.categories.general)
|
||||
@post = create(:post, tag_string: "hatsune_miku_(cosplay)")
|
||||
|
||||
assert_equal("cosplay hatsune_miku hatsune_miku_(cosplay)", @post.reload.tag_string)
|
||||
assert_equal(true, @tag.reload.character?)
|
||||
end
|
||||
end
|
||||
|
||||
context "that has been updated" do
|
||||
|
||||
Reference in New Issue
Block a user