Fix call-cluster bugs #11, #4a, #4b
#11: adding a 3rd person to a 1:1 call then having one participant close the app disconnected the call for everyone. leaveMeeting() ended a DM room for ALL peers on any leave; now it only tears down when <2 people remain, otherwise it falls through to the normal peer-left path (call continues). #4b: after someone left a call they never reappeared under "Add people". meeting-peer-left cleaned meetPeers/tiles but not meetPeerUids/meetNames, so the departed uid stayed in hereUids and was filtered out. Now deleted. #4a: a guest who enabled mic/cam on the pre-join screen had to re-tap after being admitted — the choices were applied on a blind 900ms timer that fired while still in the lobby. Now applied in the meeting-joined handler, after admission + media connect. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+5
-2
@@ -406,8 +406,11 @@ async function leaveMeeting(ws) {
|
||||
if (!peers) { if (leaverId) CHAT.broadcastPresence(leaverId); return; }
|
||||
try { await require('./calls').finalizeTranscript(room, ws._meetingUserId); } catch (_) {} // save THIS user's transcript
|
||||
peers.delete(pid);
|
||||
// 1:1 call: when either party leaves, end it for everyone (a DM call has no "remaining" call).
|
||||
if (roomToDmCall.has(room)) {
|
||||
// 1:1 call: end it for everyone ONLY when fewer than two people would remain. A DM call that had
|
||||
// extra people ADDED (via "Add people") is effectively a group now — one participant closing their
|
||||
// app must NOT hang up the call for the rest (#11). We only tear the whole thing down when ≤1 person
|
||||
// is left (nobody to talk to). With 2+ remaining we fall through to the normal peer-left path below.
|
||||
if (roomToDmCall.has(room) && peers.size < 2) {
|
||||
const others = [...peers.values()].map((p) => p.ws && p.ws._meetingUserId).filter(Boolean);
|
||||
for (const [, p] of peers) { if (p.ws.readyState === 1) { try { p.ws.send(JSON.stringify({ type: 'meeting-ended' })); } catch (_) {} p.ws._meetingRoom = null; } }
|
||||
await persistCallHistory(room); // #7: log the call BEFORE endCallByRoom clears roomToDmCall/roomToGroupCall
|
||||
|
||||
Reference in New Issue
Block a user