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

Merge pull request #1082 from matrix-org/dbkr/death_to_the_reload_chirp

Fix ringing chirp on loading
This commit is contained in:
David Baker
2019-11-21 18:20:20 +00:00
committed by GitHub

View File

@@ -4640,10 +4640,12 @@ function setupCallEventHandler(client) {
// notifications. It needs to be buffered to correctly determine if an // notifications. It needs to be buffered to correctly determine if an
// incoming call has had a matching answer/hangup. // incoming call has had a matching answer/hangup.
let callEventBuffer = []; let callEventBuffer = [];
let isClientPrepared = false; let isClientSyncing = false;
client.on("sync", function(state) { const onSync = function(state) {
if (state === "PREPARED") { if (state === "SYNCING") {
isClientPrepared = true; isClientSyncing = true;
client.removeListener("sync", onSync);
const ignoreCallIds = {}; // Set<String> const ignoreCallIds = {}; // Set<String>
// inspect the buffer and mark all calls which have been answered // inspect the buffer and mark all calls which have been answered
// or hung up before passing them to the call event handler. // or hung up before passing them to the call event handler.
@@ -4664,7 +4666,8 @@ function setupCallEventHandler(client) {
}); });
callEventBuffer = []; callEventBuffer = [];
} }
}); };
client.on("sync", onSync);
client.on("event", onEvent); client.on("event", onEvent);
@@ -4677,7 +4680,7 @@ function setupCallEventHandler(client) {
} }
return; return;
} }
if (!isClientPrepared) { if (!isClientSyncing) {
callEventBuffer.push(event); callEventBuffer.push(event);
return; return;
} }