Skip to content

Commit

Permalink
Fix and rename again
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewFerr committed Aug 6, 2024
1 parent bd4a5f9 commit a93754f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/matrixrtc/MatrixRTCSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,8 @@ export class MatrixRTCSession extends TypedEventEmitter<MatrixRTCSessionEvent, M
return this.useLegacyMemberEvents;
}

let containsOnlySessionMemberships = true;
let containsAnyOngoingSession = false;
let containsUnknownOngoingSession = false;
for (const callMemberEvent of callMemberEvents.values()) {
const content = callMemberEvent.getContent();
if (Array.isArray(content["memberships"])) {
Expand All @@ -929,12 +930,12 @@ export class MatrixRTCSession extends TypedEventEmitter<MatrixRTCSessionEvent, M
return true;
}
}
// Ignore non-ongoing legacy calls
} else {
containsOnlySessionMemberships &&= "focus_active" in content;
} else if (Object.keys(content).length > 0) {
containsAnyOngoingSession ||= true;
containsUnknownOngoingSession ||= !("focus_active" in content);
}
}
return containsOnlySessionMemberships ? false : this.useLegacyMemberEvents;
return containsAnyOngoingSession && !containsUnknownOngoingSession ? false : this.useLegacyMemberEvents;
}

private makeMembershipStateKey(localUserId: string, localDeviceId: string): string {
Expand Down

0 comments on commit a93754f

Please sign in to comment.