mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 01:55:46 +08:00
FEATURE: Watched Words: when posts contain words, do one of flag, require approval, censor, or block
This commit is contained in:
@ -247,8 +247,9 @@ describe PrettyText do
|
||||
end
|
||||
|
||||
it 'does censor code fences' do
|
||||
SiteSetting.censored_words = 'apple|banana'
|
||||
['apple', 'banana'].each { |w| Fabricate(:watched_word, word: w, action: WatchedWord.actions[:censor]) }
|
||||
expect(PrettyText.cook("# banana")).not_to include('banana')
|
||||
$redis.flushall
|
||||
end
|
||||
end
|
||||
|
||||
@ -787,11 +788,12 @@ HTML
|
||||
end
|
||||
|
||||
it 'can censor words correctly' do
|
||||
SiteSetting.censored_words = 'apple|banana'
|
||||
['apple', 'banana'].each { |w| Fabricate(:watched_word, word: w, action: WatchedWord.actions[:censor]) }
|
||||
expect(PrettyText.cook('yay banana yay')).not_to include('banana')
|
||||
expect(PrettyText.cook('yay `banana` yay')).not_to include('banana')
|
||||
expect(PrettyText.cook("# banana")).not_to include('banana')
|
||||
expect(PrettyText.cook("# banana")).to include("\u25a0\u25a0")
|
||||
$redis.flushall
|
||||
end
|
||||
|
||||
it 'supports typographer' do
|
||||
|
Reference in New Issue
Block a user