mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
new alternative reply by email addresses
This commit is contained in:
@ -0,0 +1,16 @@
|
||||
class AlternativeReplyByEmailAddressesValidator
|
||||
def initialize(opts={})
|
||||
@opts = opts
|
||||
end
|
||||
|
||||
def valid_value?(val)
|
||||
return true if val.blank?
|
||||
|
||||
validator = ReplyByEmailAddressValidator.new(@opts)
|
||||
val.split("|").all? { |v| validator.valid_value?(v) }
|
||||
end
|
||||
|
||||
def error_message
|
||||
I18n.t('site_settings.errors.invalid_alternative_reply_by_email_addresses')
|
||||
end
|
||||
end
|
@ -6,9 +6,9 @@ class ReplyByEmailAddressValidator
|
||||
def valid_value?(val)
|
||||
return true if val.blank?
|
||||
|
||||
!!(val =~ /@/i) &&
|
||||
!!(val =~ /%{reply_key}/i) &&
|
||||
val.gsub(/\+?%{reply_key}/i, "") != SiteSetting.notification_email
|
||||
!!val["@"] &&
|
||||
!!val["%{reply_key}"] &&
|
||||
val.gsub(/\+?%{reply_key}/, "") != SiteSetting.notification_email
|
||||
end
|
||||
|
||||
def error_message
|
||||
|
Reference in New Issue
Block a user