nodebb-plugin-mentions 4.8.8 → 4.8.10

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.
@@ -1,3 +1,3 @@
1
1
  {
2
- "user-mentioned-you-in": "<strong>%1</strong> mentioned you<br/><strong>%2</strong>"
2
+ "user-mentioned-you-in": "<strong>%1</strong> mentioned you <strong>%2</strong>"
3
3
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "mentions": "Mentions",
3
- "user-mentioned-you-in": "<strong>%1</strong> mentioned you<br/><strong>%2</strong>",
3
+ "user-mentioned-you-in": "<strong>%1</strong> mentioned you in <strong>%2</strong>",
4
4
  "user-mentioned-you-in-room": "<strong>%1</strong> mentioned you in <strong class=\"text-nowrap\"><i class=\"fa %2\"></i>%3</strong>",
5
- "user-mentioned-group-in": "<strong>%1</strong> mentioned <strong>%2</strong><br/><strong>%3</strong>",
5
+ "user-mentioned-group-in": "<strong>%1</strong> mentioned <strong>%2</strong> in <strong>%3</strong>",
6
6
  "notificationType-mention": "When someone mentions you"
7
7
  }
package/library.js CHANGED
@@ -26,6 +26,7 @@ const slugify = require.main.require('./src/slugify');
26
26
  const batch = require.main.require('./src/batch');
27
27
  const utils = require.main.require('./src/utils');
28
28
  const SocketPlugins = require.main.require('./src/socket.io/plugins');
29
+ const translator = require.main.require('./src/translator');
29
30
 
30
31
  const utility = require('./lib/utility');
31
32
 
@@ -136,7 +137,6 @@ Mentions.notify = async function ({ post }) {
136
137
  ]);
137
138
  const { displayname } = userData;
138
139
  const title = entitiesDecode(topic.title);
139
- const titleEscaped = title.replace(/%/g, '&#37;').replace(/,/g, '&#44;');
140
140
 
141
141
  let uids = uidsToNotify.filter(
142
142
  uid => uid !== postOwner && !topicFollowers.includes(uid)
@@ -162,7 +162,8 @@ Mentions.notify = async function ({ post }) {
162
162
 
163
163
  const filteredUids = await filterUidsAlreadyMentioned(uids, post.pid);
164
164
  if (filteredUids.length) {
165
- await sendNotificationToUids(post, filteredUids, 'user', `[[notifications:user-mentioned-you-in, ${displayname}, ${titleEscaped}]]`);
165
+ const notifText = translator.compile('notifications:user-mentioned-you-in', displayname, title);
166
+ await sendNotificationToUids(post, filteredUids, 'user', notifText);
166
167
  await db.setAdd(`mentions:pid:${post.pid}:uids`, filteredUids);
167
168
  }
168
169
 
@@ -172,7 +173,8 @@ Mentions.notify = async function ({ post }) {
172
173
  const groupName = groupsToNotify[i].name;
173
174
  const groupMentionSent = await db.isSetMember(`mentions:pid:${post.pid}:groups`, groupName);
174
175
  if (!groupMentionSent && memberUids.length) {
175
- await sendNotificationToUids(post, memberUids, groupName, `[[notifications:user-mentioned-group-in, ${displayname} , ${groupName}, ${titleEscaped}]]`);
176
+ const notifText = translator.compile('notifications:user-mentioned-group-in', displayname, groupName, title);
177
+ await sendNotificationToUids(post, memberUids, groupName, notifText);
176
178
  await db.setAdd(`mentions:pid:${post.pid}:groups`, groupName);
177
179
  }
178
180
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-mentions",
3
- "version": "4.8.8",
3
+ "version": "4.8.10",
4
4
  "description": "NodeBB Plugin that allows users to mention other users by prepending an '@' sign to their username",
5
5
  "main": "library.js",
6
6
  "repository": {