alias/implications: fixup uses of creator_ip_addr.
Fixup for a2ea2a65a. Use 127.0.0.1 rather than the creator's original IP
for any edits performed as part of an alias or implication.
This commit is contained in:
@@ -141,7 +141,7 @@ class TagAlias < TagRelationship
|
||||
Post.raw_tag_match(antecedent_name).find_each do |post|
|
||||
escaped_antecedent_name = Regexp.escape(antecedent_name)
|
||||
fixed_tags = post.tag_string.sub(/(?:\A| )#{escaped_antecedent_name}(?:\Z| )/, " #{consequent_name} ").strip
|
||||
CurrentUser.scoped(creator, creator_ip_addr) do
|
||||
CurrentUser.scoped(creator, "127.0.0.1") do
|
||||
post.update(tag_string: fixed_tags)
|
||||
end
|
||||
end
|
||||
@@ -152,7 +152,7 @@ class TagAlias < TagRelationship
|
||||
antecedent_wiki = WikiPage.titled(antecedent_name).first
|
||||
if antecedent_wiki.present?
|
||||
if WikiPage.titled(consequent_name).blank?
|
||||
CurrentUser.scoped(creator, creator_ip_addr) do
|
||||
CurrentUser.scoped(creator, "127.0.0.1") do
|
||||
antecedent_wiki.update(title: consequent_name, skip_secondary_validations: true)
|
||||
end
|
||||
else
|
||||
@@ -162,7 +162,7 @@ class TagAlias < TagRelationship
|
||||
|
||||
if antecedent_tag.category == Tag.categories.artist
|
||||
if antecedent_tag.artist.present? && consequent_tag.artist.blank?
|
||||
CurrentUser.scoped(creator, creator_ip_addr) do
|
||||
CurrentUser.scoped(creator, "127.0.0.1") do
|
||||
antecedent_tag.artist.update!(name: consequent_name)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -159,7 +159,7 @@ class TagImplication < TagRelationship
|
||||
Post.without_timeout do
|
||||
Post.raw_tag_match(antecedent_name).where("true /* TagImplication#update_posts */").find_each do |post|
|
||||
fixed_tags = "#{post.tag_string} #{descendant_names_string}".strip
|
||||
CurrentUser.scoped(creator, creator_ip_addr) do
|
||||
CurrentUser.scoped(creator, "127.0.0.1") do
|
||||
post.update(tag_string: fixed_tags)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user