You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Fix ringing chirp on loading
We have a heap of logic to do the right thing when a call event arrives, eg. wait until the client is ready so we can see if there's already been a hangup event before saying there's an incoming call. Unfortunately it only waited until the client was prepared, not until it was syncing, so any events that arrived from the server in the catchup sync bypassed this logic altogether. This was probably broken back when we introduced the sync accumulator, since before then, "PREPARED" meant, "done initialsync" rather than "loaded fake initialsync from storage". Fixes https://github.com/vector-im/riot-web/issues/3572
This commit is contained in:
@@ -4640,10 +4640,12 @@ function setupCallEventHandler(client) {
|
||||
// notifications. It needs to be buffered to correctly determine if an
|
||||
// incoming call has had a matching answer/hangup.
|
||||
let callEventBuffer = [];
|
||||
let isClientPrepared = false;
|
||||
client.on("sync", function(state) {
|
||||
if (state === "PREPARED") {
|
||||
isClientPrepared = true;
|
||||
let isClientSyncing = false;
|
||||
const onSync = function(state) {
|
||||
if (state === "SYNCING") {
|
||||
isClientSyncing = true;
|
||||
client.removeListener("sync", onSync);
|
||||
|
||||
const ignoreCallIds = {}; // Set<String>
|
||||
// inspect the buffer and mark all calls which have been answered
|
||||
// or hung up before passing them to the call event handler.
|
||||
@@ -4664,7 +4666,8 @@ function setupCallEventHandler(client) {
|
||||
});
|
||||
callEventBuffer = [];
|
||||
}
|
||||
});
|
||||
};
|
||||
client.on("sync", onSync);
|
||||
|
||||
client.on("event", onEvent);
|
||||
|
||||
@@ -4677,7 +4680,7 @@ function setupCallEventHandler(client) {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!isClientPrepared) {
|
||||
if (!isClientSyncing) {
|
||||
callEventBuffer.push(event);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user