mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 05:26:02 +08:00
FEATURE: Arbitrary validations for site settings
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
require_dependency 'enum'
|
||||
require_dependency 'site_settings/db_provider'
|
||||
require 'site_setting_validations'
|
||||
|
||||
module SiteSettingExtension
|
||||
include SiteSettingValidations
|
||||
|
||||
# For plugins, so they can tell if a feature is supported
|
||||
def supported_types
|
||||
@ -303,6 +305,10 @@ module SiteSettingExtension
|
||||
end
|
||||
end
|
||||
|
||||
if self.respond_to? "validate_#{name}"
|
||||
send("validate_#{name}", val)
|
||||
end
|
||||
|
||||
provider.save(name, val, type)
|
||||
current[name] = convert(val, type)
|
||||
clear_cache!
|
||||
|
Reference in New Issue
Block a user