BURs: when moving artists, add old tag to other names.
When aliasing or renaming an artist, add their old tag name to their other names.
This commit is contained in:
@@ -35,7 +35,9 @@ class TagMover
|
|||||||
return unless old_tag.artist? && old_artist.present? && !old_artist.is_deleted?
|
return unless old_tag.artist? && old_artist.present? && !old_artist.is_deleted?
|
||||||
|
|
||||||
if new_artist.nil?
|
if new_artist.nil?
|
||||||
old_artist.update!(name: new_tag.name)
|
old_artist.name = new_tag.name
|
||||||
|
old_artist.other_names += [old_tag.name]
|
||||||
|
old_artist.save!
|
||||||
else
|
else
|
||||||
merge_artists!
|
merge_artists!
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -285,6 +285,12 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase
|
|||||||
assert_equal(["Can't rename aaa -> bbb ('aaa' has more than 200 posts, use an alias instead)"], @bur.errors.full_messages)
|
assert_equal(["Can't rename aaa -> bbb ('aaa' has more than 200 posts, use an alias instead)"], @bur.errors.full_messages)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "when moving an artist" do
|
||||||
|
should "add the artist's old tag name to their other names" do
|
||||||
|
assert_equal(["foo"], @artist.reload.other_names)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "when renaming a character tag with a *_(cosplay) tag" do
|
context "when renaming a character tag with a *_(cosplay) tag" do
|
||||||
should "move the *_(cosplay) tag as well" do
|
should "move the *_(cosplay) tag as well" do
|
||||||
@post = create(:post, tag_string: "toosaka_rin_(cosplay)")
|
@post = create(:post, tag_string: "toosaka_rin_(cosplay)")
|
||||||
|
|||||||
Reference in New Issue
Block a user