Merge pull request #4147 from matrix-org/jryans/locked-upgrade-dialog

Use latest backup status directly rather than via state
This commit is contained in:
J. Ryan Stinnett 2020-02-28 16:45:39 +00:00 committed by GitHub
commit 67fca76027
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,7 +83,7 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
// does the server offer a UI auth flow with just m.login.password // does the server offer a UI auth flow with just m.login.password
// for /keys/device_signing/upload? // for /keys/device_signing/upload?
canUploadKeysWithPasswordOnly: null, canUploadKeysWithPasswordOnly: null,
accountPassword: props.accountPassword, accountPassword: props.accountPassword || "",
accountPasswordCorrect: null, accountPasswordCorrect: null,
// status of the key backup toggle switch // status of the key backup toggle switch
useKeyBackup: true, useKeyBackup: true,
@ -117,6 +117,11 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
backupInfo, backupInfo,
backupSigStatus, backupSigStatus,
}); });
return {
backupInfo,
backupSigStatus,
};
} }
async _queryKeyUploadAuth() { async _queryKeyUploadAuth() {
@ -269,13 +274,13 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
const RestoreKeyBackupDialog = sdk.getComponent('dialogs.keybackup.RestoreKeyBackupDialog'); const RestoreKeyBackupDialog = sdk.getComponent('dialogs.keybackup.RestoreKeyBackupDialog');
const { finished } = Modal.createTrackedDialog( const { finished } = Modal.createTrackedDialog(
'Restore Backup', '', RestoreKeyBackupDialog, {showSummary: false}, null, 'Restore Backup', '', RestoreKeyBackupDialog, {showSummary: false}, null,
/* priority = */ false, /* static = */ true, /* priority = */ false, /* static = */ false,
); );
await finished; await finished;
await this._fetchBackupInfo(); const { backupSigStatus } = await this._fetchBackupInfo();
if ( if (
this.state.backupSigStatus.usable && backupSigStatus.usable &&
this.state.canUploadKeysWithPasswordOnly && this.state.canUploadKeysWithPasswordOnly &&
this.state.accountPassword this.state.accountPassword
) { ) {