Consider cancelled verifications when mounting IncomingSasDialog

The cancellation can be because of a background problem, or because the user received another verification request from the same user. The cancel function does get called, however due to the speed of our dialog handling the state ends up being lost forever. Instead of trying to de-layer dialogs, this just fastforwards the whole dialog to "cancelled" on mount if required.

Fixes https://github.com/vector-im/riot-web/issues/10118
pull/21833/head
Travis Ralston 2019-06-19 14:59:59 -06:00
parent b16a3c53cd
commit ff3c52a736
1 changed files with 7 additions and 0 deletions

View File

@ -46,6 +46,13 @@ export default class IncomingSasDialog extends React.Component {
this._fetchOpponentProfile(); this._fetchOpponentProfile();
} }
componentWillMount() {
if (this.props.verifier.cancelled) {
console.log("Verifier was cancelled in the background.");
this.setState({phase: PHASE_CANCELLED});
}
}
componentWillUnmount() { componentWillUnmount() {
if (this.state.phase !== PHASE_CANCELLED && this.state.phase !== PHASE_VERIFIED) { if (this.state.phase !== PHASE_CANCELLED && this.state.phase !== PHASE_VERIFIED) {
this.props.verifier.cancel('User cancel'); this.props.verifier.cancel('User cancel');