diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-05-21 16:00:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-21 16:00:56 +0200 |
commit | e583f110c3ce737c292de1f47f39dd09450195dc (patch) | |
tree | f7a148f9511b1f0212ff0f4a8f2414abd10c0e6f /app/javascript | |
parent | 41b2cfe5b899e1464c0b62f8e496841aa4380c56 (diff) |
Unescape HTML entities in rich web push notifications in web UI (#7569)
Diffstat (limited to 'app/javascript')
-rw-r--r-- | app/javascript/mastodon/service_worker/web_push_notifications.js | 3 |
1 files changed, 2 insertions, 1 deletions
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(/<br\s*\/?>/g, '\n').replace(/<\/p><p>/g, '\n\n').replace(/<[^>]*>/g, ''); + unescape(html.replace(/<br\s*\/?>/g, '\n').replace(/<\/p><p>/g, '\n\n').replace(/<[^>]*>/g, '')); const handlePush = (event) => { const { access_token, notification_id, preferred_locale, title, body, icon } = event.data.json(); |