Apply aliases to characters in <character>_(cosplay) tags (#3409).
This commit is contained in:
@@ -21,7 +21,7 @@ class TagImplication < TagRelationship
|
||||
end
|
||||
|
||||
def automatic_tags_for(names)
|
||||
tags = names.grep(/\A(.+)_\(cosplay\)\Z/) { "char:#{$1}" }
|
||||
tags = names.grep(/\A(.+)_\(cosplay\)\Z/) { "char:#{TagAlias.to_aliased([$1]).first}" }
|
||||
tags << "cosplay" if tags.present?
|
||||
tags.uniq
|
||||
end
|
||||
|
||||
@@ -790,6 +790,14 @@ class PostTest < ActiveSupport::TestCase
|
||||
assert(Tag.where(name: "someone_(cosplay)", category: 4).exists?, "expected 'someone_(cosplay)' tag to be created as character")
|
||||
assert(Tag.where(name: "someone", category: 4).exists?, "expected 'someone' tag to be created")
|
||||
end
|
||||
|
||||
should "apply aliases when the character tag is added" do
|
||||
FactoryGirl.create(:tag_alias, antecedent_name: "jim", consequent_name: "james")
|
||||
@post.add_tag("jim_(cosplay)")
|
||||
@post.save
|
||||
|
||||
assert(@post.has_tag?("james"), "expected 'jim' to be aliased to 'james'")
|
||||
end
|
||||
end
|
||||
|
||||
context "for a parent" do
|
||||
|
||||
Reference in New Issue
Block a user