nodebb-plugin-mentions 4.3.2 → 4.3.4
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 +7 -3
- package/package.json +1 -1
package/library.js
CHANGED
|
@@ -171,16 +171,20 @@ Mentions.notifyMessage = async (hookData) => {
|
|
|
171
171
|
}
|
|
172
172
|
const io = require.main.require('./src/socket.io');
|
|
173
173
|
|
|
174
|
-
const [onlineUidsInRoom, isUserInRoom, checks] = await Promise.all([
|
|
174
|
+
const [onlineUidsInRoom, isUserInRoom, notifSettings, checks] = await Promise.all([
|
|
175
175
|
io.getUidsInRoom(`chat_room_${roomId}`),
|
|
176
176
|
Messaging.isUsersInRoom(matchedUids, roomId),
|
|
177
|
+
Messaging.getUidsNotificationSetting(matchedUids, roomId),
|
|
177
178
|
Promise.all(matchedUids.map(
|
|
178
179
|
uid => !roomData.groups.length || Groups.isMemberOfAny(uid, roomData.groups)
|
|
179
180
|
)),
|
|
180
181
|
]);
|
|
181
182
|
|
|
182
183
|
const uidsToNotify = matchedUids.filter(
|
|
183
|
-
(uid, idx) => checks[idx] &&
|
|
184
|
+
(uid, idx) => checks[idx] &&
|
|
185
|
+
isUserInRoom[idx] &&
|
|
186
|
+
!onlineUidsInRoom.includes(String(uid)) &&
|
|
187
|
+
notifSettings[idx] === Messaging.notificationSettings.ATMENTION
|
|
184
188
|
);
|
|
185
189
|
if (!uidsToNotify.length) {
|
|
186
190
|
return;
|
|
@@ -190,7 +194,7 @@ Mentions.notifyMessage = async (hookData) => {
|
|
|
190
194
|
type: 'mention',
|
|
191
195
|
bodyShort: `[[notifications:user_mentioned_you_in, ${message.fromUser.displayname}, ${roomName}]]`,
|
|
192
196
|
bodyLong: message.content,
|
|
193
|
-
nid: `
|
|
197
|
+
nid: `chat_${roomId}_${message.fromuid}_${message.messageId}`,
|
|
194
198
|
mid: message.messageId,
|
|
195
199
|
from: message.fromuid,
|
|
196
200
|
path: `/chats/${roomId}`,
|
package/package.json
CHANGED