Hide Delete Backup button when Secure Backup required

If Secure Backup is required by the HS admin, then this hides the Delete Backup
button in Settings to ensure everyone keeps their backup per policy.

Part of https://github.com/vector-im/element-web/issues/14954
This commit is contained in:
J. Ryan Stinnett 2020-08-17 16:00:30 +01:00
parent 1932505d3b
commit fed7ebb6bc

View file

@ -21,6 +21,7 @@ import * as sdk from '../../../index';
import {MatrixClientPeg} from '../../../MatrixClientPeg'; import {MatrixClientPeg} from '../../../MatrixClientPeg';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import Modal from '../../../Modal'; import Modal from '../../../Modal';
import { isSecureBackupRequired } from '../../../utils/WellKnownUtils';
export default class KeyBackupPanel extends React.PureComponent { export default class KeyBackupPanel extends React.PureComponent {
constructor(props) { constructor(props) {
@ -315,14 +316,19 @@ export default class KeyBackupPanel extends React.PureComponent {
trustedLocally = _t("This backup is trusted because it has been restored on this session"); trustedLocally = _t("This backup is trusted because it has been restored on this session");
} }
let deleteBackupButton;
if (!isSecureBackupRequired()) {
deleteBackupButton = <AccessibleButton kind="danger" onClick={this._deleteBackup}>
{_t("Delete Backup")}
</AccessibleButton>;
}
const buttonRow = ( const buttonRow = (
<div className="mx_KeyBackupPanel_buttonRow"> <div className="mx_KeyBackupPanel_buttonRow">
<AccessibleButton kind="primary" onClick={this._restoreBackup}> <AccessibleButton kind="primary" onClick={this._restoreBackup}>
{restoreButtonCaption} {restoreButtonCaption}
</AccessibleButton>&nbsp;&nbsp;&nbsp; </AccessibleButton>&nbsp;&nbsp;&nbsp;
<AccessibleButton kind="danger" onClick={this._deleteBackup}> {deleteBackupButton}
{_t("Delete Backup")}
</AccessibleButton>
</div> </div>
); );