LIIIIIIIIIIIIIIIINT!

pull/21833/head
David Baker 2018-09-14 17:33:25 +01:00
parent d94553bafc
commit 2e6d27717c
3 changed files with 35 additions and 15 deletions

View File

@ -14,12 +14,11 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import Modal from '../../../Modal';
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import sdk from '../../../index'; import sdk from '../../../index';
import { _t, _td } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
/** /**
* Dialog which asks the user whether they want to restore megolm keys * Dialog which asks the user whether they want to restore megolm keys

View File

@ -14,9 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import Modal from '../../../../Modal';
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import sdk from '../../../../index'; import sdk from '../../../../index';
import MatrixClientPeg from '../../../../MatrixClientPeg'; import MatrixClientPeg from '../../../../MatrixClientPeg';
import { formatCryptoKey } from '../../../../utils/FormattingUtils'; import { formatCryptoKey } from '../../../../utils/FormattingUtils';
@ -146,7 +144,7 @@ export default React.createClass({
<p>{_t("This key can decrypt your full message history.")}</p> <p>{_t("This key can decrypt your full message history.")}</p>
<p>{_t( <p>{_t(
"When you've saved it somewhere safe, proceed to the next step where the key will be used to "+ "When you've saved it somewhere safe, proceed to the next step where the key will be used to "+
"create an encrypted backup of your message keys and then destroyed." "create an encrypted backup of your message keys and then destroyed.",
)}</p> )}</p>
<div className="mx_Dialog_buttons"> <div className="mx_Dialog_buttons">
<button onClick={this._copyRecoveryKey}> <button onClick={this._copyRecoveryKey}>

View File

@ -15,7 +15,6 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import sdk from '../../../index'; import sdk from '../../../index';
import MatrixClientPeg from '../../../MatrixClientPeg'; import MatrixClientPeg from '../../../MatrixClientPeg';
@ -92,7 +91,7 @@ export default class KeyBackupPanel extends React.Component {
title: _t("Delete Backup"), title: _t("Delete Backup"),
description: _t( description: _t(
"Delete your backed up encryption keys from the server? " + "Delete your backed up encryption keys from the server? " +
"You will no longer be able to use your recovery key to read encrypted message history" "You will no longer be able to use your recovery key to read encrypted message history",
), ),
button: _t('Delete backup'), button: _t('Delete backup'),
danger: true, danger: true,
@ -104,7 +103,6 @@ export default class KeyBackupPanel extends React.Component {
}); });
}, },
}); });
} }
_verifyDevice(e) { _verifyDevice(e) {
@ -138,24 +136,49 @@ export default class KeyBackupPanel extends React.Component {
clientBackupStatus = _t("This device is uploading keys to this backup"); clientBackupStatus = _t("This device is uploading keys to this backup");
} else { } else {
// XXX: display why and how to fix it // XXX: display why and how to fix it
clientBackupStatus = _t("This device is <b>not</b> uploading keys to this backup", {}, {b: x => <b>{x}</b>}); clientBackupStatus = _t(
"This device is <b>not</b> uploading keys to this backup", {},
{b: x => <b>{x}</b>},
);
} }
let backupSigStatuses = this.state.backupSigStatus.sigs.map((sig, i) => { let backupSigStatuses = this.state.backupSigStatus.sigs.map((sig, i) => {
const sigStatSub = { const sigStatSub = {
validity: sub => <span className={sig.valid ? 'mx_KeyBackupPanel_sigValid' : 'mx_KeyBackupPanel_sigInvalid'}>{sub}</span>, validity: sub =>
verify: sub => <span className={sig.device.isVerified() ? 'mx_KeyBackupPanel_deviceVerified' : 'mx_KeyBackupPanel_deviceNotVerified'}>{sub}</span>, <span className={sig.valid ? 'mx_KeyBackupPanel_sigValid' : 'mx_KeyBackupPanel_sigInvalid'}>
{sub}
</span>,
verify: sub =>
<span className={sig.device.isVerified() ? 'mx_KeyBackupPanel_deviceVerified' : 'mx_KeyBackupPanel_deviceNotVerified'}>
{sub}
</span>,
device: sub => <span className="mx_KeyBackupPanel_deviceName">{sig.device.getDisplayName()}</span>, device: sub => <span className="mx_KeyBackupPanel_deviceName">{sig.device.getDisplayName()}</span>,
}; };
let sigStat; let sigStat;
if (sig.valid && sig.device.isVerified()) { if (sig.valid && sig.device.isVerified()) {
sigStat = _t("Backup has a <validity>valid</validity> signature from <verify>verified</verify> device <device>x</device>", {}, sigStatSub); sigStat = _t(
"Backup has a <validity>valid</validity> signature from " +
"<verify>verified</verify> device <device>x</device>",
{}, sigStatSub,
);
} else if (sig.valid && !sig.device.isVerified()) { } else if (sig.valid && !sig.device.isVerified()) {
sigStat = _t("Backup has a <validity>valid</validity> signature from <verify>unverified</verify> device <device></device>", {}, sigStatSub); sigStat = _t(
"Backup has a <validity>valid</validity> signature from " +
"<verify>unverified</verify> device <device></device>",
{}, sigStatSub,
);
} else if (!sig.valid && sig.device.isVerified()) { } else if (!sig.valid && sig.device.isVerified()) {
sigStat = _t("Backup has an <validity>invalid</validity> signature from <verify>verified</verify> device <device></device>", {}, sigStatSub); sigStat = _t(
"Backup has an <validity>invalid</validity> signature from " +
"<verify>verified</verify> device <device></device>",
{}, sigStatSub,
);
} else if (!sig.valid && !sig.device.isVerified()) { } else if (!sig.valid && !sig.device.isVerified()) {
sigStat = _t("Backup has an <validity>invalid</validity> signature from <verify>unverified</verify> device <device></device>", {}, sigStatSub); sigStat = _t(
"Backup has an <validity>invalid</validity> signature from " +
"<verify>unverified</verify> device <device></device>",
{}, sigStatSub,
);
} }
let verifyButton; let verifyButton;