diff --git a/src/domain/session/toast/verification/VerificationToastCollectionViewModel.ts b/src/domain/session/toast/verification/VerificationToastCollectionViewModel.ts index 5dfb76eb..2cd3da01 100644 --- a/src/domain/session/toast/verification/VerificationToastCollectionViewModel.ts +++ b/src/domain/session/toast/verification/VerificationToastCollectionViewModel.ts @@ -32,11 +32,13 @@ export class VerificationToastCollectionViewModel extends ViewModel { - this.track(crossSigning.receivedSASVerifications.subscribe(this)); - }) - ); + this.subscribeToSASRequests(); + } + + private async subscribeToSASRequests() { + await this.getOption("session").crossSigning.waitFor(v => !!v).promise; + const crossSigning = this.getOption("session").crossSigning.get(); + this.track(crossSigning.receivedSASVerifications.subscribe(this)); } diff --git a/src/matrix/Session.js b/src/matrix/Session.js index b999ba6b..5d16f03b 100644 --- a/src/matrix/Session.js +++ b/src/matrix/Session.js @@ -365,6 +365,7 @@ export class Session { olm: this._olm, olmUtil: this._olmUtil, deviceTracker: this._deviceTracker, + deviceMessageHandler: this._deviceMessageHandler, hsApi: this._hsApi, ownUserId: this.userId, e2eeAccount: this._e2eeAccount diff --git a/src/matrix/verification/SAS/stages/SelectVerificationMethodStage.ts b/src/matrix/verification/SAS/stages/SelectVerificationMethodStage.ts index db499d2e..aa2302fb 100644 --- a/src/matrix/verification/SAS/stages/SelectVerificationMethodStage.ts +++ b/src/matrix/verification/SAS/stages/SelectVerificationMethodStage.ts @@ -86,7 +86,11 @@ export class SelectVerificationMethodStage extends BaseSASVerificationStage { private async findDeviceName(log: ILogItem) { await log.wrap("SelectVerificationMethodStage.findDeviceName", async () => { const device = await this.options.deviceTracker.deviceForId(this.otherUserId, this.otherUserDeviceId, this.options.hsApi, log); - this.otherDeviceName = device.displayName; + if (!device) { + log.log({ l: "Cannot find device", userId: this.otherUserId, deviceId: this.otherUserDeviceId }); + throw new Error("Cannot find device"); + } + this.otherDeviceName = device.unsigned.device_display_name ?? device.device_id; }) } diff --git a/src/platform/web/ui/session/toast/ToastCollectionView.ts b/src/platform/web/ui/session/toast/ToastCollectionView.ts index 18a9c8ed..7bce15ae 100644 --- a/src/platform/web/ui/session/toast/ToastCollectionView.ts +++ b/src/platform/web/ui/session/toast/ToastCollectionView.ts @@ -37,13 +37,13 @@ function toastViewModelToView(vm: BaseToastNotificationViewModel): IView { export class ToastCollectionView extends TemplateView { render(t: Builder, vm: ToastCollectionViewModel) { - const view = new ListView({ - list: vm.toastViewModels, - parentProvidesUpdates: false, - }, (vm: CallToastNotificationViewModel) => toastViewModelToView(vm)); - return t.div({ className: "ToastCollectionView" }, [ - t.if(vm => !!vm.toastViewModels, (t) => t.view(view)), + t.ifView(vm => !!vm.toastViewModels, t => { + return new ListView({ + list: vm.toastViewModels, + parentProvidesUpdates: false, + }, (vm: CallToastNotificationViewModel) => toastViewModelToView(vm)); + }), ]); } }