mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 04:31:10 +08:00
oops fix specs.
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
class CensoredWordsValidator < ActiveModel::EachValidator
|
||||
def validate_each(record, attribute, value)
|
||||
if value =~ /#{SiteSetting.censored_words}/i
|
||||
if !SiteSetting.censored_words.blank? && value =~ /#{SiteSetting.censored_words}/i
|
||||
record.errors.add(
|
||||
attribute, :contains_censored_words,
|
||||
censored_words: SiteSetting.censored_words
|
||||
)
|
||||
elsif value =~ /#{SiteSetting.censored_pattern}/i
|
||||
elsif !SiteSetting.censored_pattern.blank? && value =~ /#{SiteSetting.censored_pattern}/i
|
||||
record.errors.add(
|
||||
attribute, :matches_censored_pattern,
|
||||
censored_pattern: SiteSetting.censored_pattern
|
||||
|
Reference in New Issue
Block a user