FIX: Make replace watched words work with wildcard (#13084)
Watched words are always regular expressions, despite watched_words_ _regular_expressions being enabled or not. Internally, wildcard characters are replaced with a regular expression that matches any non whitespace character.
This commit is contained in:
@@ -1401,11 +1401,19 @@ HTML
|
||||
after(:all) { Discourse.redis.flushdb }
|
||||
|
||||
it "replaces words with other words" do
|
||||
Fabricate(:watched_word, action: WatchedWord.actions[:replace], word: "dolor sit", replacement: "something else")
|
||||
Fabricate(:watched_word, action: WatchedWord.actions[:replace], word: "dolor sit*", replacement: "something else")
|
||||
|
||||
expect(PrettyText.cook("Lorem ipsum dolor sit amet")).to match_html(<<~HTML)
|
||||
<p>Lorem ipsum something else amet</p>
|
||||
HTML
|
||||
|
||||
expect(PrettyText.cook("Lorem ipsum dolor sits amet")).to match_html(<<~HTML)
|
||||
<p>Lorem ipsum something else amet</p>
|
||||
HTML
|
||||
|
||||
expect(PrettyText.cook("Lorem ipsum dolor sittt amet")).to match_html(<<~HTML)
|
||||
<p>Lorem ipsum something else amet</p>
|
||||
HTML
|
||||
end
|
||||
|
||||
it "replaces words with links" do
|
||||
|
||||
Reference in New Issue
Block a user