fix onLoggedIn getting called twice

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2020-04-15 13:45:12 +01:00
parent 76ce4081cb
commit 8b25223026

View file

@ -1902,13 +1902,19 @@ export default createReactClass({
const cli = MatrixClientPeg.get(); const cli = MatrixClientPeg.get();
// We're checking `isCryptoAvailable` here instead of `isCryptoEnabled` // We're checking `isCryptoAvailable` here instead of `isCryptoEnabled`
// because the client hasn't been started yet. // because the client hasn't been started yet.
if (!isCryptoAvailable()) { const cryptoAvailable = isCryptoAvailable();
if (!cryptoAvailable) {
this._onLoggedIn(); this._onLoggedIn();
} }
this.setState({ pendingInitialSync: true }); this.setState({ pendingInitialSync: true });
await this.firstSyncPromise.promise; await this.firstSyncPromise.promise;
if (!cryptoAvailable) {
this.setState({ pendingInitialSync: false });
return setLoggedInPromise;
}
// Test for the master cross-signing key in SSSS as a quick proxy for // Test for the master cross-signing key in SSSS as a quick proxy for
// whether cross-signing has been set up on the account. // whether cross-signing has been set up on the account.
const masterKeyInStorage = !!cli.getAccountData("m.cross_signing.master"); const masterKeyInStorage = !!cli.getAccountData("m.cross_signing.master");