mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 12:28:50 +03:00
Guard against race when waiting for cross-signing to be ready
Check to see if cross-signing is already set up after a verification is done to make sure it doesn't race and we end up waiting forever.
This commit is contained in:
parent
4377e4161f
commit
a04564d1e3
1 changed files with 4 additions and 3 deletions
|
@ -126,7 +126,7 @@ export class SetupEncryptionStore extends EventEmitter {
|
||||||
this.emit("update");
|
this.emit("update");
|
||||||
}
|
}
|
||||||
|
|
||||||
onVerificationRequestChange = () => {
|
onVerificationRequestChange = async () => {
|
||||||
if (this.verificationRequest.cancelled) {
|
if (this.verificationRequest.cancelled) {
|
||||||
this.verificationRequest.off("change", this.onVerificationRequestChange);
|
this.verificationRequest.off("change", this.onVerificationRequestChange);
|
||||||
this.verificationRequest = null;
|
this.verificationRequest = null;
|
||||||
|
@ -136,8 +136,9 @@ export class SetupEncryptionStore extends EventEmitter {
|
||||||
this.verificationRequest = null;
|
this.verificationRequest = null;
|
||||||
// At this point, the verification has finished, we just need to wait for
|
// At this point, the verification has finished, we just need to wait for
|
||||||
// cross signing to be ready to use, so wait for the user trust status to
|
// cross signing to be ready to use, so wait for the user trust status to
|
||||||
// change.
|
// change (or change to DONE if it's already ready).
|
||||||
this.phase = PHASE_BUSY;
|
const crossSigningReady = await MatrixClientPeg.get().isCrossSigningReady();
|
||||||
|
this.phase = crossSigningReady ? PHASE_DONE : PHASE_BUSY;
|
||||||
this.emit("update");
|
this.emit("update");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue