From 6977b4c84e2d64471886862856e049bf59225e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Thu, 15 Jun 2023 16:50:05 +0000 Subject: [PATCH] [FIX] mail: correct push notification content MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, push notificiation content was not displayed correct. When receiving message `<`, it shows `<`. This commit fixes the issue by not unescaping the content. closes odoo/odoo#125314 X-original-commit: 4f8ba016e63cb9817d61705ce262d392f7704ef5 Signed-off-by: Alexandre Kühn (aku) --- .../src/core/common/out_of_focus_service.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/addons/mail/static/src/core/common/out_of_focus_service.js b/addons/mail/static/src/core/common/out_of_focus_service.js index e2f088bc143..fac9e3be5df 100644 --- a/addons/mail/static/src/core/common/out_of_focus_service.js +++ b/addons/mail/static/src/core/common/out_of_focus_service.js @@ -5,7 +5,7 @@ import { htmlToTextContentInline } from "@mail/utils/common/format"; import { browser } from "@web/core/browser/browser"; import { _t } from "@web/core/l10n/translation"; import { registry } from "@web/core/registry"; -import { sprintf, unescapeHTML } from "@web/core/utils/strings"; +import { sprintf } from "@web/core/utils/strings"; import { url } from "@web/core/utils/urls"; const PREVIEW_MSG_MAX_SIZE = 350; // optimal for native English speakers @@ -112,15 +112,10 @@ export class OutOfFocusService { * @param {string} message */ sendNativeNotification(title, message) { - const notification = new Notification( - // The native Notification API works with plain text and not HTML - // unescaping is safe because done only at the **last** step - unescapeHTML(title), - { - body: unescapeHTML(message), - icon: "/mail/static/src/img/odoobot_transparent.png", - } - ); + const notification = new Notification(title, { + body: message, + icon: "/mail/static/src/img/odoobot_transparent.png", + }); notification.addEventListener("click", ({ target: notification }) => { window.focus(); notification.close();