Fix backup button in logout dialog
We set the caption appropriately but forgot to actually do the right thing depending on whether there was a key backup already. Also fix the loadihng spinner which was never shown. Fixes https://github.com/vector-im/riot-web/issues/8369
This commit is contained in:
parent
68ba14909b
commit
98402e7eae
1 changed files with 15 additions and 5 deletions
|
@ -34,13 +34,15 @@ export default class LogoutDialog extends React.Component {
|
||||||
this._onSetRecoveryMethodClick = this._onSetRecoveryMethodClick.bind(this);
|
this._onSetRecoveryMethodClick = this._onSetRecoveryMethodClick.bind(this);
|
||||||
this._onLogoutConfirm = this._onLogoutConfirm.bind(this);
|
this._onLogoutConfirm = this._onLogoutConfirm.bind(this);
|
||||||
|
|
||||||
|
const shouldLoadBackupStatus = !MatrixClientPeg.get().getKeyBackupEnabled();
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
loading: false,
|
loading: shouldLoadBackupStatus,
|
||||||
backupInfo: null,
|
backupInfo: null,
|
||||||
error: null,
|
error: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!MatrixClientPeg.get().getKeyBackupEnabled()) {
|
if (shouldLoadBackupStatus) {
|
||||||
this._loadBackupStatus();
|
this._loadBackupStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,9 +86,17 @@ export default class LogoutDialog extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
_onSetRecoveryMethodClick() {
|
_onSetRecoveryMethodClick() {
|
||||||
Modal.createTrackedDialogAsync('Key Backup', 'Key Backup',
|
if (this.state.backupInfo) {
|
||||||
import('../../../async-components/views/dialogs/keybackup/CreateKeyBackupDialog'),
|
// A key backup exists for this account, but the creating device is not
|
||||||
|
// verified, so restore the backup which will give us the keys from it and
|
||||||
|
// allow us to trust it (ie. upload keys to it)
|
||||||
|
const RestoreKeyBackupDialog = sdk.getComponent('dialogs.keybackup.RestoreKeyBackupDialog');
|
||||||
|
Modal.createTrackedDialog('Restore Backup', '', RestoreKeyBackupDialog, {});
|
||||||
|
} else {
|
||||||
|
Modal.createTrackedDialogAsync("Key Backup", "Key Backup",
|
||||||
|
import("../../../async-components/views/dialogs/keybackup/CreateKeyBackupDialog"),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// close dialog
|
// close dialog
|
||||||
this.props.onFinished();
|
this.props.onFinished();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue