fixes #1234
This commit is contained in:
@@ -139,4 +139,27 @@ class TagAlias < ActiveRecord::Base
|
||||
antecedent_tag.fix_post_count if antecedent_tag
|
||||
consequent_tag.fix_post_count if consequent_tag
|
||||
end
|
||||
|
||||
def rename_wiki_and_artist
|
||||
antecedent_wiki = WikiPage.titled(antecedent_name).first
|
||||
if antecedent_wiki.present? && WikiPage.titled(consequent_name).blank?
|
||||
CurrentUser.scoped(creator, creator_ip_addr) do
|
||||
antecedent_wiki.update_attributes(
|
||||
:title => consequent_name,
|
||||
:body => "[i]This page was automatically renamed from [[#{antecedent_name}]] by a tag alias.[/i]\n\n#{antecedent_wiki.body}"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
if antecedent_tag.category == Tag.categories.artist
|
||||
antecedent_artist = Artist.name_matches(antecedent_name).first
|
||||
if antecedent_artist.present? && Artist.name_matches(consequent_name).blank?
|
||||
CurrentUser.scoped(creator, creator_ip_addr) do
|
||||
antecedent_artist.update_attributes(
|
||||
:name => consequent_name
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user