[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) <tde@openerp.com>
This commit is contained in:
Aurélien Warnon
2022-06-14 10:35:45 +02:00
parent 29e14fa24c
commit ee6d0d8c83
+2 -14
View File
@@ -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, '<br>');
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, '&lt;').replace(/>/g, '&gt;');
},
/**
* Will use the mail.emojis library to wrap emojis unicode around a span with a special font
* that will make them look nicer (colored, ...).