BURs: move cosplay tags when moving character tags.

When aliasing or renaming a character tag, move the corresponding
*_(cosplay) tag if it exists.
This commit is contained in:
evazion
2020-08-27 18:40:21 -05:00
parent 23944a1794
commit b9d904ac76
2 changed files with 25 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ class TagMover
def move!
CurrentUser.scoped(user) do
move_cosplay_tag!
move_tag_category!
move_artist!
move_wiki!
@@ -56,6 +57,15 @@ class TagMover
end
end
def move_cosplay_tag!
old_cosplay_tag = "#{old_tag.name}_(cosplay)"
new_cosplay_tag = "#{new_tag.name}_(cosplay)"
if Tag.nonempty.where(name: old_cosplay_tag).exists?
TagMover.new(old_cosplay_tag, new_cosplay_tag).move!
end
end
def move_saved_searches!
SavedSearch.rewrite_queries!(old_tag.name, new_tag.name)
end