From 6e403fddb6b5df2e41dfc07151034ed865f9e4a2 Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 17 Nov 2019 14:36:33 -0600 Subject: [PATCH] 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. --- app/models/tag_alias.rb | 6 +++--- app/models/tag_implication.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/tag_alias.rb b/app/models/tag_alias.rb index bf1be4305..3fbbf8b3c 100644 --- a/app/models/tag_alias.rb +++ b/app/models/tag_alias.rb @@ -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 diff --git a/app/models/tag_implication.rb b/app/models/tag_implication.rb index fb07befd8..7f6d88bda 100644 --- a/app/models/tag_implication.rb +++ b/app/models/tag_implication.rb @@ -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