mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 17:06:31 -06:00
DEV: Change fast typer trust level setting to enum type (#23429)
We have one site setting, `auto_silence_fast_typers_max_trust_level`, which expects a trust level. However, the type is set to integer, which makes it very hard for a layman to enter the correct thing. This PR changes the type of the site setting to the `TrustLevelSetting` enum. The use of these are interchangeable in the back-end, since `SiteSetting.auto_silence_fast_typers_max_trust_level` still returns the integer value with the enum.
This commit is contained in:
parent
5e7287eba5
commit
ede73f923f
@ -1934,7 +1934,9 @@ spam:
|
||||
auto_respond_to_flag_actions: true
|
||||
min_first_post_typing_time: 3000
|
||||
auto_silence_fast_typers_on_first_post: true
|
||||
auto_silence_fast_typers_max_trust_level: 0
|
||||
auto_silence_fast_typers_max_trust_level:
|
||||
default: 0
|
||||
enum: "TrustLevelSetting"
|
||||
auto_silence_first_post_regex: ""
|
||||
high_trust_flaggers_auto_hide_posts: true
|
||||
cooldown_hours_until_reflag:
|
||||
|
@ -0,0 +1,27 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ChangeAutoSilenceFastTypersSettingToEnumType < ActiveRecord::Migration[7.0]
|
||||
def up
|
||||
execute <<~SQL
|
||||
UPDATE
|
||||
"site_settings"
|
||||
SET
|
||||
"data_type" = 7
|
||||
WHERE
|
||||
"name" = 'auto_silence_fast_typers_max_trust_level' AND
|
||||
"data_type" = 3
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
execute <<~SQL
|
||||
UPDATE
|
||||
"site_settings"
|
||||
SET
|
||||
"data_type" = 3
|
||||
WHERE
|
||||
"name" = 'auto_silence_fast_typers_max_trust_level' AND
|
||||
"data_type" = 7
|
||||
SQL
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user