mirror of
https://github.com/jcreek/EstimationPoker.git
synced 2026-07-12 18:43:47 +00:00
fix(#30): Ensure kicking a user always works
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
<script lang="ts">
|
||||
const changesLog = [
|
||||
{ timestamp: '2024-02-11T19:00:00', message: 'Added celebration when all users have the same estimate (cred: O. Nicholass)' },
|
||||
{
|
||||
timestamp: '2024-02-11T19:00:00',
|
||||
message: 'Added fix to ensure that kicking a user always works'
|
||||
},
|
||||
{
|
||||
timestamp: '2024-02-11T19:00:00',
|
||||
message: 'Added celebration when all users have the same estimate (cred: O. Nicholass)'
|
||||
},
|
||||
{ timestamp: '2024-01-05T00:00:00', message: 'Added the ability to kick a user' },
|
||||
{ timestamp: '2024-01-05T00:00:00', message: 'Added update notes' }
|
||||
];
|
||||
|
||||
@@ -171,12 +171,16 @@ wss.on('connection', (ws: WebSocket, req) => {
|
||||
console.log('kick user message received');
|
||||
if (room) {
|
||||
const userIdToKick = data.userId;
|
||||
|
||||
const ws = room.getWebSocketByUserId(userIdToKick);
|
||||
console.log(userIdToKick, ws);
|
||||
if (ws) {
|
||||
console.log('closing ws');
|
||||
ws.close();
|
||||
}
|
||||
|
||||
// Remove them from the room even if the active websocket can't be found or can't be closed
|
||||
room.removeUser(userIdToKick);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user