This commit is contained in:
r888888888
2015-05-21 12:57:10 -07:00
parent 622f12cfec
commit 555f960067
2 changed files with 32 additions and 5 deletions

View File

@@ -198,11 +198,15 @@ class TagAlias < ActiveRecord::Base
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
)
if antecedent_wiki.present?
if WikiPage.titled(consequent_name).blank?
CurrentUser.scoped(creator, creator_ip_addr) do
antecedent_wiki.update_attributes(
:title => consequent_name
)
end
else
update_forum_topic_for_wiki_conflict
end
end
@@ -249,6 +253,16 @@ class TagAlias < ActiveRecord::Base
end
end
def update_forum_topic_for_wiki_conflict
if forum_topic
CurrentUser.scoped(User.admins.first, "127.0.0.1") do
forum_topic.posts.create(
:body => "The tag alias [[#{antecedent_name}]] -> [[#{consequent_name}]] has conflicting wiki pages. [[#{consequent_name}]] should be updated to include information from [[#{antecedent_name}]] if necessary."
)
end
end
end
def reject!
update_column(:status, "deleted")
clear_all_cache