mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 21:21:19 +08:00
FIX: validate presence of 'top menu' setting
This commit is contained in:
16
lib/validators/regex_presence_validator.rb
Normal file
16
lib/validators/regex_presence_validator.rb
Normal file
@ -0,0 +1,16 @@
|
||||
class RegexPresenceValidator
|
||||
include RegexSettingValidation
|
||||
|
||||
def initialize(opts = {})
|
||||
@opts = opts
|
||||
initialize_regex_opts(opts)
|
||||
end
|
||||
|
||||
def valid_value?(val)
|
||||
val.present? && regex_match?(val)
|
||||
end
|
||||
|
||||
def error_message
|
||||
I18n.t(@regex_error)
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user