make the verif toast work with to_device request that do .request/.ready
This commit is contained in:
parent
720450f372
commit
fa13bb9689
1 changed files with 22 additions and 18 deletions
|
@ -58,10 +58,7 @@ export default class VerificationRequestToast extends React.PureComponent {
|
||||||
|
|
||||||
_checkRequestIsPending = () => {
|
_checkRequestIsPending = () => {
|
||||||
const {request} = this.props;
|
const {request} = this.props;
|
||||||
const isPendingInRoomRequest = request.channel.roomId &&
|
if (request.done || request.cancelled || request.observeOnly) {
|
||||||
!(request.ready || request.started || request.done || request.cancelled || request.observeOnly);
|
|
||||||
const isPendingDeviceRequest = request.channel.deviceId && request.started;
|
|
||||||
if (!isPendingInRoomRequest && !isPendingDeviceRequest) {
|
|
||||||
ToastStore.sharedInstance().dismissToast(this.props.toastKey);
|
ToastStore.sharedInstance().dismissToast(this.props.toastKey);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -79,6 +76,7 @@ export default class VerificationRequestToast extends React.PureComponent {
|
||||||
ToastStore.sharedInstance().dismissToast(this.props.toastKey);
|
ToastStore.sharedInstance().dismissToast(this.props.toastKey);
|
||||||
const {request} = this.props;
|
const {request} = this.props;
|
||||||
// no room id for to_device requests
|
// no room id for to_device requests
|
||||||
|
const cli = MatrixClientPeg.get();
|
||||||
try {
|
try {
|
||||||
if (request.channel.roomId) {
|
if (request.channel.roomId) {
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
|
@ -86,23 +84,29 @@ export default class VerificationRequestToast extends React.PureComponent {
|
||||||
room_id: request.channel.roomId,
|
room_id: request.channel.roomId,
|
||||||
should_peek: false,
|
should_peek: false,
|
||||||
});
|
});
|
||||||
await request.accept();
|
} else {
|
||||||
const cli = MatrixClientPeg.get();
|
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: "set_right_panel_phase",
|
action: 'view_room',
|
||||||
phase: RIGHT_PANEL_PHASES.EncryptionPanel,
|
room_id: cli.getRooms()[0].roomId,
|
||||||
refireParams: {
|
should_peek: false,
|
||||||
verificationRequest: request,
|
|
||||||
member: cli.getUser(request.otherUserId),
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
} else if (request.channel.deviceId && request.verifier) {
|
|
||||||
// show to_device verifications in dialog still
|
|
||||||
const IncomingSasDialog = sdk.getComponent("views.dialogs.IncomingSasDialog");
|
|
||||||
Modal.createTrackedDialog('Incoming Verification', '', IncomingSasDialog, {
|
|
||||||
verifier: request.verifier,
|
|
||||||
}, null, /* priority = */ false, /* static = */ true);
|
|
||||||
}
|
}
|
||||||
|
await request.accept();
|
||||||
|
dis.dispatch({
|
||||||
|
action: "set_right_panel_phase",
|
||||||
|
phase: RIGHT_PANEL_PHASES.EncryptionPanel,
|
||||||
|
refireParams: {
|
||||||
|
verificationRequest: request,
|
||||||
|
member: cli.getUser(request.otherUserId),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
// } else if (request.channel.deviceId && request.verifier) {
|
||||||
|
// // show to_device verifications in dialog still
|
||||||
|
// const IncomingSasDialog = sdk.getComponent("views.dialogs.IncomingSasDialog");
|
||||||
|
// Modal.createTrackedDialog('Incoming Verification', '', IncomingSasDialog, {
|
||||||
|
// verifier: request.verifier,
|
||||||
|
// }, null, /* priority = */ false, /* static = */ true);
|
||||||
|
// }
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err.message);
|
console.error(err.message);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue