From ee6d0d8c837ff1f43850e6252923787ca647aefe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Warnon?= Date: Mon, 13 Dec 2021 10:23:25 +0000 Subject: [PATCH] [IMP] mail: cleanup '_htmlEscape' usage We instead use the standard owl.utils.escape. This allows having less custom implementations of escaping and rely on existing tools. Task-2622893 closes odoo/odoo#81293 Related: odoo/enterprise#22850 Signed-off-by: Thibault Delavallee (tde) --- addons/mail/static/src/js/emojis_mixin.js | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/addons/mail/static/src/js/emojis_mixin.js b/addons/mail/static/src/js/emojis_mixin.js index 3a40347250a..d2902f508f7 100644 --- a/addons/mail/static/src/js/emojis_mixin.js +++ b/addons/mail/static/src/js/emojis_mixin.js @@ -1,5 +1,6 @@ /** @odoo-module **/ +import { escape } from '@web/core/utils/strings'; import emojis from '@mail/js/emojis'; /** @@ -49,26 +50,13 @@ export default { * @param {String} message a text message to format */ _formatText: function (message) { - message = this._htmlEscape(message); + message = escape(message); message = this._wrapEmojis(message); message = message.replace(/(?:\r\n|\r|\n)/g, '
'); return message; }, - /** - * Adapted from qweb2.js#html_escape to avoid formatting '&' - * - * @param {String} s - * @private - */ - _htmlEscape: function (s) { - if (s == null) { - return ''; - } - return String(s).replace(//g, '>'); - }, - /** * Will use the mail.emojis library to wrap emojis unicode around a span with a special font * that will make them look nicer (colored, ...).