Merge pull request #2753 from evazion/feat-autotag-cosplay
Autotag character_(cosplay) -> character, cosplay.
This commit is contained in:
@@ -608,8 +608,8 @@ class Post < ActiveRecord::Base
|
||||
normalized_tags = remove_negated_tags(normalized_tags)
|
||||
normalized_tags = normalized_tags.map {|x| Tag.find_or_create_by_name(x).name}
|
||||
normalized_tags = %w(tagme) if normalized_tags.empty?
|
||||
normalized_tags = add_automatic_tags(normalized_tags)
|
||||
normalized_tags = TagAlias.to_aliased(normalized_tags)
|
||||
normalized_tags = add_automatic_tags(normalized_tags)
|
||||
normalized_tags = TagImplication.with_descendants(normalized_tags)
|
||||
normalized_tags.sort!
|
||||
set_tag_string(normalized_tags.uniq.sort.join(" "))
|
||||
@@ -678,6 +678,10 @@ class Post < ActiveRecord::Base
|
||||
tags << "ugoira"
|
||||
end
|
||||
|
||||
characters = tags.grep(/\A(.+)_\(cosplay\)\Z/) { $1 }
|
||||
tags += characters
|
||||
tags << "cosplay" if characters.present?
|
||||
|
||||
return tags
|
||||
end
|
||||
|
||||
|
||||
@@ -932,6 +932,20 @@ class PostTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
context "with *_(cosplay) tags" do
|
||||
setup do
|
||||
@post.add_tag("hakurei_reimu_(cosplay)")
|
||||
@post.add_tag("hatsune_miku_(cosplay)")
|
||||
@post.save
|
||||
end
|
||||
|
||||
should "add the character tags and the cosplay tag" do
|
||||
assert(@post.has_tag?("hakurei_reimu"))
|
||||
assert(@post.has_tag?("hatsune_miku"))
|
||||
assert(@post.has_tag?("cosplay"))
|
||||
end
|
||||
end
|
||||
|
||||
context "that has been updated" do
|
||||
should "create a new version if it's the first version" do
|
||||
assert_difference("PostVersion.count", 1) do
|
||||
|
||||
Reference in New Issue
Block a user