mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-05 05:25:49 +01:00
chore: eslint prefer-template
This commit is contained in:
committed by
Julian Lam
parent
4ee0f1459d
commit
707b55b6a5
@@ -28,21 +28,21 @@ module.exports = function (Messaging) {
|
||||
uids.forEach(function (uid) {
|
||||
data.self = parseInt(uid, 10) === parseInt(fromUid, 10) ? 1 : 0;
|
||||
Messaging.pushUnreadCount(uid);
|
||||
sockets.in('uid_' + uid).emit('event:chats.receive', data);
|
||||
sockets.in(`uid_${uid}`).emit('event:chats.receive', data);
|
||||
});
|
||||
if (messageObj.system) {
|
||||
return;
|
||||
}
|
||||
// Delayed notifications
|
||||
let queueObj = Messaging.notifyQueue[fromUid + ':' + roomId];
|
||||
let queueObj = Messaging.notifyQueue[`${fromUid}:${roomId}`];
|
||||
if (queueObj) {
|
||||
queueObj.message.content += '\n' + messageObj.content;
|
||||
queueObj.message.content += `\n${messageObj.content}`;
|
||||
clearTimeout(queueObj.timeout);
|
||||
} else {
|
||||
queueObj = {
|
||||
message: messageObj,
|
||||
};
|
||||
Messaging.notifyQueue[fromUid + ':' + roomId] = queueObj;
|
||||
Messaging.notifyQueue[`${fromUid}:${roomId}`] = queueObj;
|
||||
}
|
||||
|
||||
queueObj.timeout = setTimeout(function () {
|
||||
@@ -60,15 +60,15 @@ module.exports = function (Messaging) {
|
||||
const isGroupChat = await Messaging.isGroupChat(roomId);
|
||||
const notification = await notifications.create({
|
||||
type: isGroupChat ? 'new-group-chat' : 'new-chat',
|
||||
subject: '[[email:notif.chat.subject, ' + messageObj.fromUser.username + ']]',
|
||||
bodyShort: '[[notifications:new_message_from, ' + messageObj.fromUser.username + ']]',
|
||||
subject: `[[email:notif.chat.subject, ${messageObj.fromUser.username}]]`,
|
||||
bodyShort: `[[notifications:new_message_from, ${messageObj.fromUser.username}]]`,
|
||||
bodyLong: messageObj.content,
|
||||
nid: 'chat_' + fromuid + '_' + roomId,
|
||||
nid: `chat_${fromuid}_${roomId}`,
|
||||
from: fromuid,
|
||||
path: '/chats/' + messageObj.roomId,
|
||||
path: `/chats/${messageObj.roomId}`,
|
||||
});
|
||||
|
||||
delete Messaging.notifyQueue[fromuid + ':' + roomId];
|
||||
delete Messaging.notifyQueue[`${fromuid}:${roomId}`];
|
||||
notifications.push(notification, uids);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user