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:
evazion
2019-11-17 14:36:33 -06:00
parent e29d7162a4
commit 6e403fddb6
2 changed files with 4 additions and 4 deletions

View File

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

View File

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