diff --git a/app/logical/alias_and_implication_importer.rb b/app/logical/alias_and_implication_importer.rb index 936f05836..4a8fb3f99 100644 --- a/app/logical/alias_and_implication_importer.rb +++ b/app/logical/alias_and_implication_importer.rb @@ -156,7 +156,7 @@ private tag_implication.reject!(update_topic: false) when :mass_update - TagBatchChangeJob.perform_later(token[1], token[2], CurrentUser.user, CurrentUser.ip_addr) + TagBatchChangeJob.perform_later(token[1], token[2], User.system, "127.0.0.1") when :change_category tag = Tag.find_by_name(token[1]) diff --git a/app/models/bulk_update_request.rb b/app/models/bulk_update_request.rb index c6ce15e45..cad9dc550 100644 --- a/app/models/bulk_update_request.rb +++ b/app/models/bulk_update_request.rb @@ -77,7 +77,7 @@ class BulkUpdateRequest < ApplicationRecord transaction do CurrentUser.scoped(approver) do AliasAndImplicationImporter.new(script, forum_topic_id, "1", true).process! - update(status: "approved", approver: CurrentUser.user, skip_secondary_validations: true) + update!(status: "approved", approver: approver, skip_secondary_validations: true) forum_updater.update("The #{bulk_update_request_link} (forum ##{forum_post.id}) has been approved by @#{approver.name}.", "APPROVED") end end diff --git a/app/models/tag_alias.rb b/app/models/tag_alias.rb index 3fbbf8b3c..719a800dd 100644 --- a/app/models/tag_alias.rb +++ b/app/models/tag_alias.rb @@ -56,15 +56,15 @@ class TagAlias < TagRelationship tries = 0 begin - CurrentUser.scoped(approver) do - update(status: "processing") + CurrentUser.scoped(User.system) do + update!(status: "processing") move_aliases_and_implications move_saved_searches ensure_category_consistency update_posts forum_updater.update(approval_message(approver), "APPROVED") if update_topic rename_wiki_and_artist - update(status: "active") + update!(status: "active") end rescue Exception => e if tries < 5 @@ -141,9 +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, "127.0.0.1") do - post.update(tag_string: fixed_tags) - end + post.update(tag_string: fixed_tags) end end end @@ -152,9 +150,7 @@ class TagAlias < TagRelationship antecedent_wiki = WikiPage.titled(antecedent_name).first if antecedent_wiki.present? if WikiPage.titled(consequent_name).blank? - CurrentUser.scoped(creator, "127.0.0.1") do - antecedent_wiki.update(title: consequent_name, skip_secondary_validations: true) - end + antecedent_wiki.update!(title: consequent_name, skip_secondary_validations: true) else forum_updater.update(conflict_message) end @@ -162,9 +158,7 @@ class TagAlias < TagRelationship if antecedent_tag.category == Tag.categories.artist if antecedent_tag.artist.present? && consequent_tag.artist.blank? - CurrentUser.scoped(creator, "127.0.0.1") do - antecedent_tag.artist.update!(name: consequent_name) - end + antecedent_tag.artist.update!(name: consequent_name) end end end diff --git a/app/models/tag_implication.rb b/app/models/tag_implication.rb index 7f6d88bda..6b4324f4e 100644 --- a/app/models/tag_implication.rb +++ b/app/models/tag_implication.rb @@ -134,7 +134,7 @@ class TagImplication < TagRelationship tries = 0 begin - CurrentUser.scoped(approver) do + CurrentUser.scoped(User.system) do update(status: "processing") update_posts update(status: "active") @@ -159,9 +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, "127.0.0.1") do - post.update(tag_string: fixed_tags) - end + post.update(tag_string: fixed_tags) end end end