Fix accept team invite multiple times

This commit is contained in:
yflory 2025-03-17 16:24:30 +01:00
parent 93f8ea2d07
commit 8e343ac9a8

View File

@ -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] = [];