From 75ec5cd9c4dfeb562ce18f4cdc0f1632a814aa2b Mon Sep 17 00:00:00 2001 From: NigeParis Date: Mon, 22 Dec 2025 19:02:17 +0100 Subject: [PATCH] WIP on bloccage invitaion - no working at all yet --- src/chat/src/sendInvite.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/chat/src/sendInvite.ts b/src/chat/src/sendInvite.ts index 489dc89..7c252ec 100644 --- a/src/chat/src/sendInvite.ts +++ b/src/chat/src/sendInvite.ts @@ -16,15 +16,16 @@ export function sendInvite(fastify: FastifyInstance, innerHtml: string, profil: let targetSocket; for (const socket of sockets) { const clientInfo: string = clientChat.get(socket.id)?.user || ''; + targetSocket = socket || null; + if (!targetSocket) continue; + console.log(color.yellow, 'DEBUG LOG: user online found', profil.user, 'socket', targetSocket.id); if (clientInfo === profil.user) { - console.log(color.yellow, 'DEBUG LOG: user online found', profil.user); - targetSocket = socket || ''; - break; + profil.innerHtml = innerHtml ?? ''; + if (targetSocket.id) { + targetSocket.emit('inviteGame', profil); + } + return; } } - profil.innerHtml = innerHtml ?? ''; - if (targetSocket) { - targetSocket.emit('inviteGame', profil); - } }); }