FIX: Censored word match fail if earlier partial match

Previously a list containing `one|two|three|four|twoagain` would fail to censor the word `twoagain` in the text `test1 twoagain test2`.
This commit is contained in:
Dean Taylor 2014-10-17 03:10:30 +01:00
parent 0a5acba77e
commit b023e81078
1 changed files with 4 additions and 1 deletions

View File

@ -481,11 +481,14 @@ test("images", function() {
});
test("censoring", function() {
Discourse.SiteSettings.censored_words = "shucks|whiz";
Discourse.SiteSettings.censored_words = "shucks|whiz|whizzer";
cooked("aw shucks, golly gee whiz.",
"<p>aw &#9632;&#9632;&#9632;&#9632;&#9632;&#9632;, golly gee &#9632;&#9632;&#9632;&#9632;.</p>",
"it censors words in the Site Settings");
cooked("you are a whizzard! I love cheesewhiz. Whiz.",
"<p>you are a whizzard! I love cheesewhiz. &#9632;&#9632;&#9632;&#9632;.</p>",
"it doesn't censor words unless they have boundaries.");
cooked("you are a whizzer! I love cheesewhiz. Whiz.",
"<p>you are a &#9632;&#9632;&#9632;&#9632;&#9632;&#9632;&#9632;! I love cheesewhiz. &#9632;&#9632;&#9632;&#9632;.</p>",
"it censor words even if previous partical matches exist.");
});