FIX: prevents i18n helper to return a SafeString (#9191)

For convenience the i18n helper has been made returning a SafeString, but when used with other helpers, a String is expected and will cause unexpected behaviors.

This is the root cause of the initial bug fixed in d2bb127e2c

This commit is kept as it's a better security in case of unexpected behavior.
This commit is contained in:
Joffrey JAFFEUX
2020-03-12 16:50:20 +01:00
committed by GitHub
parent 59578dfc5b
commit 6102c287f7
39 changed files with 58 additions and 57 deletions

View File

@@ -1,7 +1,6 @@
import { registerUnbound } from "discourse-common/lib/helpers";
import { htmlSafe } from "@ember/template";
registerUnbound("i18n", (key, params) => htmlSafe(I18n.t(key, params)));
registerUnbound("i18n", (key, params) => I18n.t(key, params));
registerUnbound("i18n-yes-no", (value, params) =>
I18n.t(value ? "yes_value" : "no_value", params)
);