DEV: Remove `PostProcessed` trigger option (#13916)

It was deprecated 5 years ago in e55e2aff94

I've seen it still being used in the wild, even though it doesn't do anything anymore as I understand it.
This commit is contained in:
Jarek Radosz 2021-08-04 22:24:47 +02:00 committed by GitHub
parent fbd1cd5fe1
commit 07c6b720bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 11 deletions

View File

@ -75,11 +75,10 @@ class Badge < ActiveRecord::Base
attr_accessor :has_badge
def self.trigger_hash
Hash[*(
Badge::Trigger.constants.map { |k|
[k.to_s.underscore, Badge::Trigger.const_get(k)]
}.flatten
)]
@trigger_hash ||= Badge::Trigger.constants.map do |k|
name = k.to_s.underscore
[name, Badge::Trigger.const_get(k)] unless name =~ /deprecated/
end.compact.to_h
end
module Trigger
@ -88,7 +87,7 @@ class Badge < ActiveRecord::Base
PostRevision = 2
TrustLevelChange = 4
UserChange = 8
PostProcessed = 16 # deprecated
DeprecatedPostProcessed = 16 # No longer in use
def self.is_none?(trigger)
[None].include? trigger

View File

@ -5221,7 +5221,6 @@ en:
post_revision: "When a user edits or creates a post"
trust_level_change: "When a user changes trust level"
user_change: "When a user is edited or created"
post_processed: "After a post is processed"
preview:
link_text: "Preview granted badges"
plan_text: "Preview with query plan"

View File

@ -0,0 +1,12 @@
# frozen_string_literal: true
class RemovePostProcessedTriggerOption < ActiveRecord::Migration[6.1]
def up
# Replace Badge::Trigger::PostProcessed (16) with None (0)
DB.exec("UPDATE badges SET trigger = 0 WHERE trigger = 16")
end
def down
raise ActiveRecord::IrreversibleMigration
end
end

View File

@ -198,9 +198,6 @@
"trust_level_change": {
"type": "integer"
},
"post_processed": {
"type": "integer"
},
"post_action": {
"type": "integer"
}
@ -210,7 +207,6 @@
"none",
"post_revision",
"trust_level_change",
"post_processed",
"post_action"
]
},