mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 11:13:22 +08:00
FIX: Replace censored watched word consistently (#12486)
Applying oneboxes and replacing censored watched words does not happen in a strict order which often lead to inconsistencies. This commit fixes the behavior and will never censor oneboxes. To make it always censor oneboxes implies significant changes to the PrettyText pipeline.
This commit is contained in:
parent
deb9e3cd22
commit
d7bd62d9cf
|
@ -3,6 +3,10 @@ import { censorFn } from "pretty-text/censored-words";
|
|||
function recurse(tokens, apply) {
|
||||
let i;
|
||||
for (i = 0; i < tokens.length; i++) {
|
||||
if (tokens[i].type === "html_raw" && tokens[i].onebox) {
|
||||
continue;
|
||||
}
|
||||
|
||||
apply(tokens[i]);
|
||||
if (tokens[i].children) {
|
||||
recurse(tokens[i].children, apply);
|
||||
|
|
|
@ -81,6 +81,7 @@ function applyOnebox(state, silent) {
|
|||
child.type = "html_raw";
|
||||
child.content = cached;
|
||||
child.inline = true;
|
||||
child.onebox = true;
|
||||
|
||||
text.type = "html_raw";
|
||||
text.content = "";
|
||||
|
|
Loading…
Reference in New Issue
Block a user