nodebb-plugin-mentions 4.8.7 → 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/library.js +9 -6
- package/package.json +1 -1
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:
|
|
226
|
-
nid: `chat_${roomId}_${message.fromuid}_${message.
|
|
227
|
-
mid: message.
|
|
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
|
-
|
|
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