only update user list if its open

This commit is contained in:
Barış Soner Uşaklı
2023-07-14 13:01:41 -04:00
parent cfa00ece35
commit f0775651b9
5 changed files with 35 additions and 32 deletions

View File

@@ -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]]');