diff --git a/src/matrixrtc/MatrixRTCSession.ts b/src/matrixrtc/MatrixRTCSession.ts index cc155fd3e6a..7f6d12aa203 100644 --- a/src/matrixrtc/MatrixRTCSession.ts +++ b/src/matrixrtc/MatrixRTCSession.ts @@ -160,26 +160,27 @@ export class MatrixRTCSession extends TypedEventEmitter 1 && "focus_active" in content) { + // We have a MSC4143 event membership event + membershipContents.push(content); + } else if (eventKeysCount === 1 && "memberships" in content) { // we have a legacy (one event for all devices) event if (!Array.isArray(content["memberships"])) { logger.warn(`Malformed member event from ${memberEvent.getSender()}: memberships is not an array`); continue; } membershipContents = content["memberships"]; - } else { - // We have a MSC4143 event membership event - if (Object.keys(content).length !== 0) { - // We checked for empty content to not try to construct CallMembership's with {}. - membershipContents.push(content); - } - } - if (membershipContents.length === 0) { - continue; } + if (membershipContents.length === 0) continue; + for (const membershipData of membershipContents) { try { const membership = new CallMembership(memberEvent, membershipData);