diff --git a/app/jobs/tag_batch_change_job.rb b/app/jobs/tag_batch_change_job.rb index 934d1bdc5..9d0a6dbd8 100644 --- a/app/jobs/tag_batch_change_job.rb +++ b/app/jobs/tag_batch_change_job.rb @@ -7,7 +7,6 @@ class TagBatchChangeJob < ApplicationJob CurrentUser.scoped(User.system) do migrate_posts(normalized_antecedent, normalized_consequent) - ModAction.log("processed mass update: #{antecedent} -> #{consequent}", :mass_update) end end diff --git a/app/models/mod_action.rb b/app/models/mod_action.rb index 430948648..87fbfda97 100644 --- a/app/models/mod_action.rb +++ b/app/models/mod_action.rb @@ -41,13 +41,13 @@ class ModAction < ApplicationRecord forum_post_update: 101, forum_post_delete: 102, tag_alias_create: 120, - tag_alias_update: 121, + tag_alias_update: 121, # XXX unused tag_implication_create: 140, - tag_implication_update: 141, + tag_implication_update: 141, # XXX unused ip_ban_create: 160, ip_ban_delete: 162, ip_ban_undelete: 163, - mass_update: 1000, + mass_update: 1000, # XXX unused bulk_revert: 1001, # XXX unused other: 2000 } diff --git a/app/models/tag_alias.rb b/app/models/tag_alias.rb index f3884ef03..82c79374f 100644 --- a/app/models/tag_alias.rb +++ b/app/models/tag_alias.rb @@ -1,5 +1,4 @@ class TagAlias < TagRelationship - after_save :create_mod_action validates_uniqueness_of :antecedent_name, scope: :status, conditions: -> { active } validate :absence_of_transitive_relation @@ -23,24 +22,4 @@ class TagAlias < TagRelationship errors[:base] << "A tag alias for #{consequent_name} already exists" end end - - def create_mod_action - alias_desc = %("tag alias ##{id}":[#{Rails.application.routes.url_helpers.tag_alias_path(self)}]: [[#{antecedent_name}]] -> [[#{consequent_name}]]) - - if saved_change_to_id? - ModAction.log("created #{status} #{alias_desc}", :tag_alias_create) - else - # format the changes hash more nicely. - change_desc = saved_changes.except(:updated_at).map do |attribute, values| - old, new = values[0], values[1] - if old.nil? - %(set #{attribute} to "#{new}") - else - %(changed #{attribute} from "#{old}" to "#{new}") - end - end.join(", ") - - ModAction.log("updated #{alias_desc}\n#{change_desc}", :tag_alias_update) - end - end end diff --git a/app/models/tag_implication.rb b/app/models/tag_implication.rb index ab7da6bc8..ccb889d55 100644 --- a/app/models/tag_implication.rb +++ b/app/models/tag_implication.rb @@ -2,7 +2,6 @@ class TagImplication < TagRelationship has_many :child_implications, class_name: "TagImplication", primary_key: :consequent_name, foreign_key: :antecedent_name has_many :parent_implications, class_name: "TagImplication", primary_key: :antecedent_name, foreign_key: :consequent_name - after_save :create_mod_action validates :antecedent_name, uniqueness: { scope: [:consequent_name, :status], conditions: -> { active }} validate :absence_of_circular_relation validate :absence_of_transitive_relation @@ -121,26 +120,6 @@ class TagImplication < TagRelationship end end end - - def create_mod_action - implication = %("tag implication ##{id}":[#{Rails.application.routes.url_helpers.tag_implication_path(self)}]: [[#{antecedent_name}]] -> [[#{consequent_name}]]) - - if saved_change_to_id? - ModAction.log("created #{status} #{implication}", :tag_implication_create) - else - # format the changes hash more nicely. - change_desc = saved_changes.except(:updated_at).map do |attribute, values| - old, new = values[0], values[1] - if old.nil? - %(set #{attribute} to "#{new}") - else - %(changed #{attribute} from "#{old}" to "#{new}") - end - end.join(", ") - - ModAction.log("updated #{implication}\n#{change_desc}", :tag_implication_update) - end - end end include DescendantMethods diff --git a/test/jobs/tag_batch_change_job_test.rb b/test/jobs/tag_batch_change_job_test.rb index 40b3a6ced..3b44611ad 100644 --- a/test/jobs/tag_batch_change_job_test.rb +++ b/test/jobs/tag_batch_change_job_test.rb @@ -11,10 +11,5 @@ class TagBatchChangeJobTest < ActiveJob::TestCase TagBatchChangeJob.perform_now("aaa", "bbb") assert_equal("bbb", @post.reload.tag_string) end - - should "log a modaction" do - TagBatchChangeJob.perform_now("1", "2") - assert_equal("mass_update", ModAction.last.category) - end end end