From d6b239e58fc94bd3bcb5a2c91057c8c0f695e4d1 Mon Sep 17 00:00:00 2001 From: Bruno Windels <274386+bwindels@users.noreply.github.com> Date: Wed, 20 Apr 2022 16:42:20 +0200 Subject: [PATCH] ensure we always set the correct session id when joining --- src/matrix/calls/group/GroupCall.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/matrix/calls/group/GroupCall.ts b/src/matrix/calls/group/GroupCall.ts index 892ed67c..0332d317 100644 --- a/src/matrix/calls/group/GroupCall.ts +++ b/src/matrix/calls/group/GroupCall.ts @@ -326,16 +326,12 @@ export class GroupCall extends EventEmitter<{change: never}> { }; callsInfo.push(callInfo); } - const devicesInfo = callInfo["m.devices"]; - let deviceInfo = devicesInfo.find(d => d["device_id"] === this.options.ownDeviceId); - if (!deviceInfo) { - deviceInfo = { - ["device_id"]: this.options.ownDeviceId, - ["session_id"]: this.options.sessionId, - feeds: [{purpose: "m.usermedia"}] - }; - devicesInfo.push(deviceInfo); - } + callInfo["m.devices"] = callInfo["m.devices"].filter(d => d["device_id"] !== this.options.ownDeviceId); + callInfo["m.devices"].push({ + ["device_id"]: this.options.ownDeviceId, + ["session_id"]: this.options.sessionId, + feeds: [{purpose: "m.usermedia"}] + }); return stateContent; }