nodebb-plugin-web-push 0.7.9 → 0.7.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/library.js +3 -3
- package/package.json +1 -1
package/library.js
CHANGED
|
@@ -105,8 +105,8 @@ plugin.addRoutes = async ({ router, middleware, helpers }) => {
|
|
|
105
105
|
const payload = await constructPayload({
|
|
106
106
|
nid: utils.generateUUID(),
|
|
107
107
|
bodyShort: 'Test notification',
|
|
108
|
-
// test notification
|
|
109
|
-
bodyLong: 'This is a <bdi>test</
|
|
108
|
+
// test notification shouldn't show any html chars
|
|
109
|
+
bodyLong: 'This is a <bdi>test</bdi> message sent from <strong>NodeBB</strong>',
|
|
110
110
|
path: `/me/web-push`,
|
|
111
111
|
}, req.uid, userLang);
|
|
112
112
|
await webPush.sendNotification(subscription, JSON.stringify(payload));
|
|
@@ -218,7 +218,7 @@ async function constructPayload(notification, uid, lang) {
|
|
|
218
218
|
|
|
219
219
|
const { nid, mergeId, bodyShort, bodyLong, path } = notification;
|
|
220
220
|
|
|
221
|
-
let [title, body] = await translator.translateKeys([bodyShort, bodyLong], lang);
|
|
221
|
+
let [title, body] = await translator.translateKeys([bodyShort || '', bodyLong || ''], lang);
|
|
222
222
|
([title, body] = [title, body].map(str => utils.stripHTMLTags(utils.decodeHTMLEntities(str))));
|
|
223
223
|
title = `${dir === 'rtl' ? '\u200f' : '\u200e'}${title}`;
|
|
224
224
|
const tag = mergeId || nid;
|