mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
oops fix specs.
This commit is contained in:
parent
3d21ccd4a5
commit
429b02a5d5
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user