mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
don't assume the call handler is always set in device message handler
This commit is contained in:
parent
22a8182266
commit
4a46c98d12
@ -74,29 +74,31 @@ export class DeviceMessageHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async afterSyncCompleted(decryptionResults, deviceTracker, hsApi, log) {
|
async afterSyncCompleted(decryptionResults, deviceTracker, hsApi, log) {
|
||||||
// if we don't have a device, we need to fetch the device keys the message claims
|
if (this._callHandler) {
|
||||||
// and check the keys, and we should only do network requests during
|
// if we don't have a device, we need to fetch the device keys the message claims
|
||||||
// sync processing in the afterSyncCompleted step.
|
// and check the keys, and we should only do network requests during
|
||||||
const callMessages = decryptionResults.filter(dr => this._callHandler.handlesDeviceMessageEventType(dr.event?.type));
|
// sync processing in the afterSyncCompleted step.
|
||||||
if (callMessages.length) {
|
const callMessages = decryptionResults.filter(dr => this._callHandler.handlesDeviceMessageEventType(dr.event?.type));
|
||||||
await log.wrap("process call signalling messages", async log => {
|
if (callMessages.length) {
|
||||||
for (const dr of callMessages) {
|
await log.wrap("process call signalling messages", async log => {
|
||||||
// serialize device loading, so subsequent messages for the same device take advantage of the cache
|
for (const dr of callMessages) {
|
||||||
const device = await deviceTracker.deviceForId(dr.event.sender, dr.event.content.device_id, hsApi, log);
|
// serialize device loading, so subsequent messages for the same device take advantage of the cache
|
||||||
dr.setDevice(device);
|
const device = await deviceTracker.deviceForId(dr.event.sender, dr.event.content.device_id, hsApi, log);
|
||||||
if (dr.isVerified) {
|
dr.setDevice(device);
|
||||||
this._callHandler.handleDeviceMessage(dr.event, dr.userId, dr.deviceId, log);
|
if (dr.isVerified) {
|
||||||
} else {
|
this._callHandler.handleDeviceMessage(dr.event, dr.userId, dr.deviceId, log);
|
||||||
log.log({
|
} else {
|
||||||
l: "could not verify olm fingerprint key matches, ignoring",
|
log.log({
|
||||||
ed25519Key: dr.device.ed25519Key,
|
l: "could not verify olm fingerprint key matches, ignoring",
|
||||||
claimedEd25519Key: dr.claimedEd25519Key,
|
ed25519Key: dr.device.ed25519Key,
|
||||||
deviceId: device.deviceId,
|
claimedEd25519Key: dr.claimedEd25519Key,
|
||||||
userId: device.userId,
|
deviceId: device.deviceId,
|
||||||
});
|
userId: device.userId,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user