1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-23 17:02:25 +03:00

make sonar cube happy (it does not know about the type constraints...)

Signed-off-by: Timo K <toger5@hotmail.de>
This commit is contained in:
Timo K
2025-09-30 15:58:25 +02:00
parent 25f4d6f8fb
commit 84a3d56f90

View File

@@ -253,7 +253,7 @@ export class CallMembership {
switch (kind) { switch (kind) {
case "rtc": case "rtc":
return data.member.user_id; return data.member.user_id;
case "session": default: // "session":
return this.parentEventData.sender; return this.parentEventData.sender;
} }
} }
@@ -271,7 +271,7 @@ export class CallMembership {
switch (kind) { switch (kind) {
case "rtc": case "rtc":
return data.slot_id; return data.slot_id;
case "session": default: // "session":
return slotDescriptionToId({ application: this.application, id: data.call_id }); return slotDescriptionToId({ application: this.application, id: data.call_id });
} }
} }
@@ -281,7 +281,7 @@ export class CallMembership {
switch (kind) { switch (kind) {
case "rtc": case "rtc":
return data.member.device_id; return data.member.device_id;
case "session": default: // "session":
return data.device_id; return data.device_id;
} }
} }
@@ -302,7 +302,7 @@ export class CallMembership {
switch (kind) { switch (kind) {
case "rtc": case "rtc":
return data.application.type; return data.application.type;
case "session": default: // "session":
return data.application; return data.application;
} }
} }
@@ -311,7 +311,7 @@ export class CallMembership {
switch (kind) { switch (kind) {
case "rtc": case "rtc":
return data.application; return data.application;
case "session": default: // "session":
return { "type": data.application, "m.call.intent": data["m.call.intent"] }; return { "type": data.application, "m.call.intent": data["m.call.intent"] };
} }
} }
@@ -322,10 +322,8 @@ export class CallMembership {
switch (kind) { switch (kind) {
case "rtc": case "rtc":
return undefined; return undefined;
case "session": default: // "session":
return data.scope; return data.scope;
default:
return undefined;
} }
} }
@@ -337,7 +335,7 @@ export class CallMembership {
switch (kind) { switch (kind) {
case "rtc": case "rtc":
return data.member.id; return data.member.id;
case "session": default: // "session":
return (this.createdTs() ?? "").toString(); return (this.createdTs() ?? "").toString();
} }
} }
@@ -348,7 +346,7 @@ export class CallMembership {
case "rtc": case "rtc":
// TODO we need to read the referenced (relation) event if available to get the real created_ts // TODO we need to read the referenced (relation) event if available to get the real created_ts
return this.parentEvent.getTs(); return this.parentEvent.getTs();
case "session": default: // "session":
return data.created_ts ?? this.parentEvent.getTs(); return data.created_ts ?? this.parentEvent.getTs();
} }
} }
@@ -362,7 +360,7 @@ export class CallMembership {
switch (kind) { switch (kind) {
case "rtc": case "rtc":
return undefined; return undefined;
case "session": default: // "session":
// TODO: calculate this from the MatrixRTCSession join configuration directly // TODO: calculate this from the MatrixRTCSession join configuration directly
return this.createdTs() + (data.expires ?? DEFAULT_EXPIRE_DURATION); return this.createdTs() + (data.expires ?? DEFAULT_EXPIRE_DURATION);
} }
@@ -376,7 +374,7 @@ export class CallMembership {
switch (kind) { switch (kind) {
case "rtc": case "rtc":
return undefined; return undefined;
case "session": default: // "session":
// Assume that local clock is sufficiently in sync with other clocks in the distributed system. // Assume that local clock is sufficiently in sync with other clocks in the distributed system.
// We used to try and adjust for the local clock being skewed, but there are cases where this is not accurate. // We used to try and adjust for the local clock being skewed, but there are cases where this is not accurate.
// The current implementation allows for the local clock to be -infinity to +MatrixRTCSession.MEMBERSHIP_EXPIRY_TIME/2 // The current implementation allows for the local clock to be -infinity to +MatrixRTCSession.MEMBERSHIP_EXPIRY_TIME/2
@@ -392,7 +390,7 @@ export class CallMembership {
switch (kind) { switch (kind) {
case "rtc": case "rtc":
return false; return false;
case "session": default: // "session":
return this.getMsUntilExpiry()! <= 0; return this.getMsUntilExpiry()! <= 0;
} }
} }
@@ -409,21 +407,22 @@ export class CallMembership {
return data.rtc_transports[0]; return data.rtc_transports[0];
case "session": case "session":
switch (data.focus_active.focus_selection) { switch (data.focus_active.focus_selection) {
case "multi_sfu":
return data.foci_preferred[0];
case "oldest_membership": case "oldest_membership":
if (CallMembership.equal(this, oldestMembership)) return data.foci_preferred[0]; if (CallMembership.equal(this, oldestMembership)) return data.foci_preferred[0];
if (oldestMembership !== undefined) return oldestMembership.getTransport(oldestMembership); if (oldestMembership !== undefined) return oldestMembership.getTransport(oldestMembership);
break; break;
case "multi_sfu":
return data.foci_preferred[0];
} }
} }
return undefined;
} }
public get transports(): Transport[] { public get transports(): Transport[] {
const { kind, data } = this.membershipData; const { kind, data } = this.membershipData;
switch (kind) { switch (kind) {
case "rtc": case "rtc":
return data.rtc_transports; return data.rtc_transports;
case "session": default: // "session":
return data.foci_preferred; return data.foci_preferred;
} }
} }