Skip to content

Commit

Permalink
Split nested ternary operator into method
Browse files Browse the repository at this point in the history
Sonar typescript:S3358
  • Loading branch information
AndrewFerr committed Jun 21, 2024
1 parent df08343 commit ffd2442
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/matrixrtc/MatrixRTCSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -869,9 +869,7 @@ export class MatrixRTCSession extends TypedEventEmitter<MatrixRTCSessionEvent, M
this.room.roomId,
EventType.GroupCallMemberPrefix,
newContent,
legacy
? localUserId
: `${!/^org\.matrix\.msc3779\b/.exec(this.room.getVersion()) ? "_" : "" + localUserId}_${localDeviceId}`,
legacy ? localUserId : this.makeMembershipStateKey(localUserId, localDeviceId),
);
logger.info(`Sent updated call member event.`);

Expand Down Expand Up @@ -901,6 +899,15 @@ export class MatrixRTCSession extends TypedEventEmitter<MatrixRTCSessionEvent, M
return false;
}

private makeMembershipStateKey(localUserId: string, localDeviceId: string): string {
const stateKey = `${localUserId}_${localDeviceId}`;
if (/^org\.matrix\.msc3779\b/.exec(this.room.getVersion())) {
return stateKey;
} else {
return `_${stateKey}`;
}
}

private onRotateKeyTimeout = (): void => {
if (!this.manageMediaKeys) return;

Expand Down

0 comments on commit ffd2442

Please sign in to comment.