mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-21 07:50:37 +01:00
only update user list if its open
This commit is contained in:
@@ -97,10 +97,6 @@ function onConnection(socket) {
|
||||
socket.on('disconnect', () => {
|
||||
onDisconnect(socket);
|
||||
});
|
||||
|
||||
socket.on('disconnecting', () => {
|
||||
onDisconnecting(socket);
|
||||
});
|
||||
}
|
||||
|
||||
function onDisconnect(socket) {
|
||||
@@ -108,19 +104,6 @@ function onDisconnect(socket) {
|
||||
plugins.hooks.fire('action:sockets.disconnect', { socket: socket });
|
||||
}
|
||||
|
||||
async function onDisconnecting(socket) {
|
||||
if (socket.uid > 0) {
|
||||
for (const roomName of socket.rooms) {
|
||||
if (roomName.startsWith('chat_room') && !roomName.includes('public')) {
|
||||
Sockets.server.in(roomName).emit('event:chats.user-online', {
|
||||
uid: socket.uid,
|
||||
state: 0,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function onConnect(socket) {
|
||||
try {
|
||||
await validateSession(socket, '[[error:invalid-session]]');
|
||||
|
||||
Reference in New Issue
Block a user