mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-14 11:05:41 +05:00
Fix accept team invite multiple times
This commit is contained in:
parent
93f8ea2d07
commit
8e343ac9a8
@ -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] = [];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user