nodebb-plugin-mentions 4.3.4 → 4.3.5

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,6 +1,7 @@
1
1
  {
2
2
  "mentions": "Mentions",
3
3
  "user_mentioned_you_in": "<strong>%1</strong> mentioned you in <strong>%2</strong>",
4
+ "user_mentioned_you_in_room": "<strong>%1</strong> mentioned you in <strong class=\"text-nowrap\"><i class=\"fa %2\"></i>%3</strong>",
4
5
  "user_mentioned_group_in": "<strong>%1</strong> mentioned <strong>%2</strong> in <strong>%3</strong>",
5
6
  "notificationType_mention": "When someone mentions you"
6
7
  }
package/library.js CHANGED
@@ -171,8 +171,9 @@ Mentions.notifyMessage = async (hookData) => {
171
171
  }
172
172
  const io = require.main.require('./src/socket.io');
173
173
 
174
- const [onlineUidsInRoom, isUserInRoom, notifSettings, checks] = await Promise.all([
174
+ const [onlineUidsInRoom, fromUser, isUserInRoom, notifSettings, checks] = await Promise.all([
175
175
  io.getUidsInRoom(`chat_room_${roomId}`),
176
+ User.getUserFields(message.fromuid, ['username']),
176
177
  Messaging.isUsersInRoom(matchedUids, roomId),
177
178
  Messaging.getUidsNotificationSetting(matchedUids, roomId),
178
179
  Promise.all(matchedUids.map(
@@ -190,9 +191,10 @@ Mentions.notifyMessage = async (hookData) => {
190
191
  return;
191
192
  }
192
193
  const roomName = validator.escape(String(roomData.roomName || `Room ${roomId}`));
194
+ const icon = Messaging.getRoomIcon(roomData);
193
195
  const notifObj = await Notifications.create({
194
196
  type: 'mention',
195
- bodyShort: `[[notifications:user_mentioned_you_in, ${message.fromUser.displayname}, ${roomName}]]`,
197
+ bodyShort: `[[notifications:user_mentioned_you_in_room, ${fromUser.displayname}, ${icon}, ${roomName}]]`,
196
198
  bodyLong: message.content,
197
199
  nid: `chat_${roomId}_${message.fromuid}_${message.messageId}`,
198
200
  mid: message.messageId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-mentions",
3
- "version": "4.3.4",
3
+ "version": "4.3.5",
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
  "scripts": {
@@ -32,8 +32,8 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "mocha": "10.2.0",
35
- "eslint": "8.45.0",
35
+ "eslint": "8.47.0",
36
36
  "eslint-config-nodebb": "0.2.1",
37
- "eslint-plugin-import": "2.27.5"
37
+ "eslint-plugin-import": "2.28.1"
38
38
  }
39
39
  }