Aggregate device verification toasts into one toast
'Review' now opens the only place we can verify our own devices: our user info.
This commit is contained in:
parent
698a539866
commit
e5d06b1acb
3 changed files with 27 additions and 48 deletions
|
@ -18,6 +18,7 @@ import React from 'react';
|
|||
import PropTypes from 'prop-types';
|
||||
import { _t } from '../../../languageHandler';
|
||||
import Modal from "../../../Modal";
|
||||
import dis from "../../../dispatcher";
|
||||
import { MatrixClientPeg } from '../../../MatrixClientPeg';
|
||||
import DeviceListener from '../../../DeviceListener';
|
||||
import NewSessionReviewDialog from '../dialogs/NewSessionReviewDialog';
|
||||
|
@ -26,29 +27,17 @@ import { replaceableComponent } from '../../../utils/replaceableComponent';
|
|||
|
||||
@replaceableComponent("views.toasts.UnverifiedSessionToast")
|
||||
export default class UnverifiedSessionToast extends React.PureComponent {
|
||||
static propTypes = {
|
||||
toastKey: PropTypes.string.isRequired,
|
||||
device: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
_onLaterClick = () => {
|
||||
const { device } = this.props;
|
||||
DeviceListener.sharedInstance().dismissVerification(device.deviceId);
|
||||
DeviceListener.sharedInstance().dismissVerifications();
|
||||
};
|
||||
|
||||
_onReviewClick = async () => {
|
||||
const { device } = this.props;
|
||||
DeviceListener.sharedInstance().dismissVerifications();
|
||||
|
||||
Modal.createTrackedDialog('New Session Review', 'Starting dialog', NewSessionReviewDialog, {
|
||||
dis.dispatch({
|
||||
action: 'view_user_info',
|
||||
userId: MatrixClientPeg.get().getUserId(),
|
||||
device,
|
||||
onFinished: (r) => {
|
||||
if (!r) {
|
||||
/* This'll come back false if the user clicks "this wasn't me" and saw a warning dialog */
|
||||
this._onLaterClick();
|
||||
}
|
||||
},
|
||||
}, null, /* priority = */ false, /* static = */ true);
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
|
@ -56,11 +45,7 @@ export default class UnverifiedSessionToast extends React.PureComponent {
|
|||
|
||||
return (<div>
|
||||
<div className="mx_Toast_description">
|
||||
<span className="mx_Toast_deviceName">
|
||||
{device.getDisplayName()}
|
||||
</span> <span className="mx_Toast_deviceID">
|
||||
({device.deviceId})
|
||||
</span>
|
||||
{_t("Verify your other sessions")}
|
||||
</div>
|
||||
<div className="mx_Toast_buttons" aria-live="off">
|
||||
<FormButton label={_t("Later")} kind="danger" onClick={this._onLaterClick} />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue