[FIX] mail: correct push notification content

Before this commit, push notificiation content
was not displayed correct.

When receiving message `&lt;`, 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) <aku@odoo.com>
This commit is contained in:
Alexandre Kühn
2023-06-16 12:19:06 +02:00
parent d2e5e8b883
commit 6977b4c84e
@@ -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();