mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Introduce site settings which require confirmation (#27315)
Many site settings can be distructive or have huge side-effects for a site that the admin may not be aware of when changing it. This commit introduces a `requires_confirmation` attribute that can be added to any site setting. When it is true, a confirmation dialog will open if that setting is changed in the admin UI, optionally with a custom message that is defined in client.en.yml. If the admin does not confirm, we reset the setting to its previous clean value and do not save the new value.
This commit is contained in:
@@ -20,12 +20,15 @@ class SiteSettings::TypeSupervisor
|
||||
list_type
|
||||
textarea
|
||||
json_schema
|
||||
requires_confirmation
|
||||
].freeze
|
||||
VALIDATOR_OPTS = %i[min max regex hidden regex_error json_schema].freeze
|
||||
|
||||
# For plugins, so they can tell if a feature is supported
|
||||
SUPPORTED_TYPES = %i[email username list enum].freeze
|
||||
|
||||
REQUIRES_CONFIRMATION_TYPES = { simple: "simple", user_option: "user_option" }.freeze
|
||||
|
||||
def self.types
|
||||
@types ||=
|
||||
Enum.new(
|
||||
|
||||
Reference in New Issue
Block a user