From 413a149b4713feded25cc23f912200871c456188 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Sun, 2 Feb 2020 10:47:15 +0100 Subject: [PATCH] disable "Accept"/"Decline" buttons on verif tile after clicking to avoid sending double events --- src/components/views/messages/MKeyVerificationRequest.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/views/messages/MKeyVerificationRequest.js b/src/components/views/messages/MKeyVerificationRequest.js index ab02b2e5ad..9a48858bc7 100644 --- a/src/components/views/messages/MKeyVerificationRequest.js +++ b/src/components/views/messages/MKeyVerificationRequest.js @@ -27,6 +27,7 @@ import {RIGHT_PANEL_PHASES} from "../../../stores/RightPanelStorePhases"; export default class MKeyVerificationRequest extends React.Component { constructor(props) { super(props); + this.state = {}; } componentDidMount() { @@ -58,6 +59,7 @@ export default class MKeyVerificationRequest extends React.Component { }; _onAcceptClicked = async () => { + this.setState({acceptOrCancelClicked: true}); const request = this.props.mxEvent.verificationRequest; if (request) { try { @@ -70,6 +72,7 @@ export default class MKeyVerificationRequest extends React.Component { }; _onRejectClicked = async () => { + this.setState({acceptOrCancelClicked: true}); const request = this.props.mxEvent.verificationRequest; if (request) { try { @@ -135,9 +138,10 @@ export default class MKeyVerificationRequest extends React.Component { subtitle = (
{ userLabelForEventRoom(request.requestingUserId, mxEvent.getRoomId())}
); if (request.requested && !request.observeOnly) { + const disabled = this.state.acceptOrCancelClicked; stateNode = (
- - + +
); } } else { // request sent by us