BURs: make rename command move aliases/implications.
Make the tag rename command also move any aliases or implications from the old tag to the new tag. Previously only the create alias command moved aliases and implications.
This commit is contained in:
@@ -9,6 +9,8 @@ class TagMover
|
||||
|
||||
def move!
|
||||
CurrentUser.scoped(user) do
|
||||
move_aliases!
|
||||
move_implications!
|
||||
move_cosplay_tag!
|
||||
move_tag_category!
|
||||
move_artist!
|
||||
@@ -57,6 +59,22 @@ class TagMover
|
||||
end
|
||||
end
|
||||
|
||||
def move_aliases!
|
||||
old_tag.consequent_aliases.each do |tag_alias|
|
||||
tag_alias.update!(consequent_name: new_tag.name)
|
||||
end
|
||||
end
|
||||
|
||||
def move_implications!
|
||||
old_tag.antecedent_implications.each do |tag_implication|
|
||||
tag_implication.update!(antecedent_name: new_tag.name)
|
||||
end
|
||||
|
||||
old_tag.consequent_implications.each do |tag_implication|
|
||||
tag_implication.update!(consequent_name: new_tag.name)
|
||||
end
|
||||
end
|
||||
|
||||
def move_cosplay_tag!
|
||||
old_cosplay_tag = "#{old_tag.name}_(cosplay)"
|
||||
new_cosplay_tag = "#{new_tag.name}_(cosplay)"
|
||||
|
||||
Reference in New Issue
Block a user