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:
@@ -31,7 +31,7 @@ class TagNameValidator < ActiveModel::EachValidator
|
||||
tag_name = TagAlias.to_aliased([$1]).first
|
||||
tag = Tag.find_by_name(tag_name)
|
||||
|
||||
if tag.present? && !tag.character?
|
||||
if tag.present? && !tag.empty? && !tag.character?
|
||||
record.errors[attribute] << "#{tag_name} must be a character tag"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user