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.
Files changed (2) hide show
  1. package/library.js +3 -3
  2. 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 shouln't show any html chars
109
- bodyLong: 'This is a &lt;bdi&gt;test&lt;/bid&gt; message sent from <strong>NodeBB</strong>',
108
+ // test notification shouldn't show any html chars
109
+ bodyLong: 'This is a &lt;bdi&gt;test&lt;/bdi&gt; 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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-web-push",
3
- "version": "0.7.9",
3
+ "version": "0.7.11",
4
4
  "description": "A plugin for adding native push notifications to NodeBB via the Web Push API.",
5
5
  "main": "library.js",
6
6
  "repository": {