From 8e343ac9a85c2f96edbf6ff08e76a55e46c2f9d6 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 17 Mar 2025 16:24:30 +0100 Subject: [PATCH] Fix accept team invite multiple times --- src/worker/modules/team.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/worker/modules/team.js b/src/worker/modules/team.js index 1e27ab1dd..708044659 100644 --- a/src/worker/modules/team.js +++ b/src/worker/modules/team.js @@ -931,6 +931,14 @@ const factory = (Util, Hash, Constants, Realtime, ProxyManager, var team = data.team; if (!(team.hash || team.roHash) || !team.channel || !team.password || !team.keys || !team.metadata) { return void cb({error: 'EINVAL'}); } + + let myTeams = ctx.store.proxy.teams; + if (Object.values(myTeams).some(obj => { + return obj.channel === team.channel; + })) { + return void cb({error: 'EEXISTS'}); + } + var id = Util.createRandomInteger(); ctx.store.proxy.teams[id] = team; ctx.onReadyHandlers[id] = [];