mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 09:05:53 +08:00
FEATURE: Censor Oneboxes (#12902)
Previously onebox content was not passed by the censor regex, meaning you could sneak in censored words via onebox.
This commit is contained in:
@ -455,7 +455,10 @@ module Oneboxer
|
||||
onebox_options[:user_agent] = user_agent_override if user_agent_override
|
||||
|
||||
r = Onebox.preview(uri.to_s, onebox_options)
|
||||
result = { onebox: r.to_s, preview: r&.placeholder_html.to_s }
|
||||
result = {
|
||||
onebox: WordWatcher.censor(r.to_s),
|
||||
preview: WordWatcher.censor(r&.placeholder_html.to_s)
|
||||
}
|
||||
|
||||
# NOTE: Call r.errors after calling placeholder_html
|
||||
if r.errors.any?
|
||||
|
Reference in New Issue
Block a user