This commit is contained in:
Toks
2013-05-02 22:25:44 -04:00
parent d5d68fcff9
commit 0f5fe4e7b6
5 changed files with 50 additions and 3 deletions

View File

@@ -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