nodebb-plugin-mentions 4.8.6 → 4.8.8

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/LICENSE CHANGED
@@ -1,8 +1,8 @@
1
- Copyright (c) 2013-2014, Julian Lam <julian@designcreateplay.com>
2
- All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
-
6
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
1
+ Copyright (c) 2013-2014, Julian Lam <julian@designcreateplay.com>
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+
6
+ Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
+ Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
8
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,14 +1,14 @@
1
- # Username/Group Mentions
2
-
3
- This NodeBB plugin allows posters to reference (or *mention*) other users or groups on a NodeBB by simply
4
- precluding the `@` symbol before a username.
5
-
6
- A link is automatically added to the post.
7
-
8
- ## Installation
9
-
10
- This plugin is bundled with every NodeBB install. If not, you can install it via the Plugins page of the ACP.
11
-
12
- Alternatively,
13
-
1
+ # Username/Group Mentions
2
+
3
+ This NodeBB plugin allows posters to reference (or *mention*) other users or groups on a NodeBB by simply
4
+ precluding the `@` symbol before a username.
5
+
6
+ A link is automatically added to the post.
7
+
8
+ ## Installation
9
+
10
+ This plugin is bundled with every NodeBB install. If not, you can install it via the Plugins page of the ACP.
11
+
12
+ Alternatively,
13
+
14
14
  npm install nodebb-plugin-mentions
@@ -1,3 +1,3 @@
1
1
  {
2
- "user-mentioned-you-in": "<strong>%1</strong> mentioned you in <strong>%2</strong>"
2
+ "user-mentioned-you-in": "<strong>%1</strong> mentioned you<br/><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 in <strong>%2</strong>",
3
+ "user-mentioned-you-in": "<strong>%1</strong> mentioned you<br/><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> in <strong>%3</strong>",
5
+ "user-mentioned-group-in": "<strong>%1</strong> mentioned <strong>%2</strong><br/><strong>%3</strong>",
6
6
  "notificationType-mention": "When someone mentions you"
7
7
  }
package/library.js CHANGED
@@ -198,11 +198,12 @@ Mentions.notifyMessage = async (hookData) => {
198
198
  }
199
199
  const io = require.main.require('./src/socket.io');
200
200
 
201
- const [onlineUidsInRoom, fromUser, isUserInRoom, notifSettings, checks] = await Promise.all([
201
+ const [onlineUidsInRoom, fromUser, isUserInRoom, notifSettings, parsedMessage, checks] = await Promise.all([
202
202
  io.getUidsInRoom(`chat_room_${roomId}`),
203
203
  User.getUserFields(message.fromuid, ['username']),
204
204
  Messaging.isUsersInRoom(matchedUids, roomId),
205
205
  Messaging.getUidsNotificationSetting(matchedUids, roomId),
206
+ Messaging.parse(message.content, message.fromuid, 0, message.roomId, false),
206
207
  Promise.all(matchedUids.map(
207
208
  uid => !roomData.groups.length || Groups.isMemberOfAny(uid, roomData.groups)
208
209
  )),
@@ -222,9 +223,9 @@ Mentions.notifyMessage = async (hookData) => {
222
223
  const notifObj = await Notifications.create({
223
224
  type: 'mention',
224
225
  bodyShort: `[[notifications:user-mentioned-you-in-room, ${fromUser.displayname}, ${icon}, ${roomName}]]`,
225
- bodyLong: message.content,
226
- nid: `chat_${roomId}_${message.fromuid}_${message.messageId}`,
227
- mid: message.messageId,
226
+ bodyLong: parsedMessage,
227
+ nid: `chat_${roomId}_${message.fromuid}_${message.mid}`,
228
+ mid: message.mid,
228
229
  from: message.fromuid,
229
230
  path: `/chats/${roomId}`,
230
231
  importance: 6,
@@ -314,7 +315,10 @@ async function sendNotificationToUids(postData, uids, nidType, notificationText)
314
315
  }
315
316
 
316
317
  async function createNotification(postData, nidType, notificationText) {
317
- const title = await Topics.getTopicField(postData.tid, 'title');
318
+ // postData.sourceContent or postData.content is not parsed yet
319
+ // this is triggered from action:post.save or action:post.edit
320
+ await posts.parsePost(postData);
321
+
318
322
  return await Notifications.create({
319
323
  type: 'mention',
320
324
  bodyShort: notificationText,
@@ -324,7 +328,6 @@ async function createNotification(postData, nidType, notificationText) {
324
328
  tid: postData.tid,
325
329
  from: postData.uid,
326
330
  path: `/post/${encodeURIComponent(postData.pid)}`,
327
- topicTitle: title ? utils.decodeHTMLEntities(title) : title,
328
331
  importance: 6,
329
332
  });
330
333
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-mentions",
3
- "version": "4.8.6",
3
+ "version": "4.8.8",
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": {