fix: on leave/kick remove matching sockets from rooms

This commit is contained in:
Barış Soner Uşaklı
2023-07-15 18:08:31 -04:00
parent 640e32d49c
commit a766f74f0e
2 changed files with 17 additions and 1 deletions

View File

@@ -228,10 +228,11 @@ chatsAPI.kick = async (caller, data) => {
// Additional checks if kicking vs leaving
if (data.uids.length === 1 && parseInt(data.uids[0], 10) === caller.uid) {
await messaging.leaveRoom([caller.uid], data.roomId);
await socketHelpers.removeSocketsFromRoomByUids([caller.uid], data.roomId);
return [];
}
await messaging.removeUsersFromRoom(caller.uid, data.uids, data.roomId);
await socketHelpers.removeSocketsFromRoomByUids(data.uids, data.roomId);
delete data.uids;
return chatsAPI.users(caller, data);
};