Merge pull request #4081 from matrix-org/bwindels/cancelondialogclose

Cancel verification request on dialog close
This commit is contained in:
Bruno Windels 2020-02-20 11:00:00 +00:00 committed by GitHub
commit 913caf67a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,10 +26,15 @@ export default class VerificationRequestDialog extends React.Component {
onFinished: PropTypes.func.isRequired, onFinished: PropTypes.func.isRequired,
}; };
constructor(...args) {
super(...args);
this.onFinished = this.onFinished.bind(this);
}
render() { render() {
const BaseDialog = sdk.getComponent("views.dialogs.BaseDialog"); const BaseDialog = sdk.getComponent("views.dialogs.BaseDialog");
const EncryptionPanel = sdk.getComponent("views.right_panel.EncryptionPanel"); const EncryptionPanel = sdk.getComponent("views.right_panel.EncryptionPanel");
return <BaseDialog className="mx_InfoDialog" onFinished={this.props.onFinished} return <BaseDialog className="mx_InfoDialog" onFinished={this.onFinished}
contentId="mx_Dialog_content" contentId="mx_Dialog_content"
title={_t("Verification Request")} title={_t("Verification Request")}
hasCancel={true} hasCancel={true}
@ -42,4 +47,9 @@ export default class VerificationRequestDialog extends React.Component {
/> />
</BaseDialog>; </BaseDialog>;
} }
onFinished() {
this.props.verificationRequest.cancel();
this.props.onFinished();
}
} }