DEV: Deprecate htmlHelper (#29495)

This commit is contained in:
Jarek Radosz 2024-10-31 00:37:37 +01:00 committed by GitHub
parent 33b2845adc
commit ae8d919528
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -1,4 +1,6 @@
import { htmlHelper } from "discourse-common/lib/helpers";
import { htmlSafe } from "@ember/template";
import I18n from "discourse-i18n";
export default htmlHelper((size) => I18n.toHumanSize(size));
export default function (size) {
return htmlSafe(I18n.toHumanSize(size));
}

View File

@ -13,6 +13,11 @@ export function makeArray(obj) {
}
export function htmlHelper(fn) {
deprecated(
`htmlHelper is deprecated. Use a plain function and \`htmlSafe()\` from "@ember/template" instead.`,
{ id: "discourse.html-helper" }
);
return Helper.helper(function (...args) {
args =
args.length > 1 ? args[0].concat({ hash: args[args.length - 1] }) : args;