From e583f110c3ce737c292de1f47f39dd09450195dc Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 21 May 2018 16:00:56 +0200 Subject: [PATCH] Unescape HTML entities in rich web push notifications in web UI (#7569) --- .../mastodon/service_worker/web_push_notifications.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/service_worker/web_push_notifications.js b/app/javascript/mastodon/service_worker/web_push_notifications.js index d10463822..f922f7dd0 100644 --- a/app/javascript/mastodon/service_worker/web_push_notifications.js +++ b/app/javascript/mastodon/service_worker/web_push_notifications.js @@ -1,5 +1,6 @@ import IntlMessageFormat from 'intl-messageformat'; import locales from './web_push_locales'; +import { unescape } from 'lodash'; const MAX_NOTIFICATIONS = 5; const GROUP_TAG = 'tag'; @@ -60,7 +61,7 @@ const formatMessage = (messageId, locale, values = {}) => (new IntlMessageFormat(locales[locale][messageId], locale)).format(values); const htmlToPlainText = html => - html.replace(//g, '\n').replace(/<\/p>

/g, '\n\n').replace(/<[^>]*>/g, ''); + unescape(html.replace(//g, '\n').replace(/<\/p>

/g, '\n\n').replace(/<[^>]*>/g, '')); const handlePush = (event) => { const { access_token, notification_id, preferred_locale, title, body, icon } = event.data.json();