mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 17:16:14 +01:00
moved some socket notifications to notifyUser instead of in websocket layer (again, @barisusakli)
This commit is contained in:
@@ -162,22 +162,6 @@ SocketModules.chats.send = function(socket, data, callback) {
|
||||
|
||||
Messaging.notifyUser(socket.uid, touid, message);
|
||||
|
||||
// Recipient
|
||||
SocketModules.chats.pushUnreadCount(touid);
|
||||
server.in('uid_' + touid).emit('event:chats.receive', {
|
||||
withUid: socket.uid,
|
||||
message: message,
|
||||
self: 0
|
||||
});
|
||||
|
||||
// Sender
|
||||
SocketModules.chats.pushUnreadCount(socket.uid);
|
||||
server.in('uid_' + socket.uid).emit('event:chats.receive', {
|
||||
withUid: touid,
|
||||
message: message,
|
||||
self: 1
|
||||
});
|
||||
|
||||
callback();
|
||||
});
|
||||
});
|
||||
@@ -189,19 +173,10 @@ SocketModules.chats.canMessage = function(socket, toUid, callback) {
|
||||
});
|
||||
};
|
||||
|
||||
SocketModules.chats.pushUnreadCount = function(uid) {
|
||||
Messaging.getUnreadCount(uid, function(err, unreadCount) {
|
||||
if (err) {
|
||||
return;
|
||||
}
|
||||
server.in('uid_' + uid).emit('event:unread.updateChatCount', null, unreadCount);
|
||||
});
|
||||
};
|
||||
|
||||
SocketModules.chats.markRead = function(socket, touid, callback) {
|
||||
Messaging.markRead(socket.uid, touid, function(err) {
|
||||
if (!err) {
|
||||
SocketModules.chats.pushUnreadCount(socket.uid);
|
||||
Messaging.pushUnreadCount(socket.uid);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user