From c4f16591161bfc261a9c7fd34b0525962481bb75 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 29 Jan 2020 15:22:05 +0100 Subject: [PATCH 1/4] don't dismiss toasts for device verification as they are immediately started --- src/components/views/toasts/VerificationRequestToast.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/views/toasts/VerificationRequestToast.js b/src/components/views/toasts/VerificationRequestToast.js index 342b7d840c..d7b2880b92 100644 --- a/src/components/views/toasts/VerificationRequestToast.js +++ b/src/components/views/toasts/VerificationRequestToast.js @@ -56,7 +56,10 @@ export default class VerificationRequestToast extends React.PureComponent { _checkRequestIsPending = () => { const {request} = this.props; - if (request.ready || request.started || request.done || request.cancelled || request.observeOnly) { + const isPendingInRoomRequest = request.channel.roomId && + !(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); } }; From 59dc3cfb97c21833a99a0ede22dcc312a1d3911d Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 29 Jan 2020 15:23:13 +0100 Subject: [PATCH 2/4] update immediately, don't wait until verification is done this can deadlock, as you can't finish the verification without the UI --- src/components/views/right_panel/VerificationPanel.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/views/right_panel/VerificationPanel.js b/src/components/views/right_panel/VerificationPanel.js index 18a9024310..a34dfbfdd0 100644 --- a/src/components/views/right_panel/VerificationPanel.js +++ b/src/components/views/right_panel/VerificationPanel.js @@ -217,9 +217,12 @@ export default class VerificationPanel extends React.PureComponent { }; _onRequestChange = async () => { + this.forceUpdate(); const {request} = this.props; - if (!this._hasVerifier && !!request.verifier) { - request.verifier.on('show_sas', this._onVerifierShowSas); + const hadVerifier = this._hasVerifier; + this._hasVerifier = !!request.verifier; + if (!hadVerifier && this._hasVerifier) { + request.verifier.once('show_sas', this._onVerifierShowSas); try { // on the requester side, this is also awaited in _startSAS, // but that's ok as verify should return the same promise. @@ -227,10 +230,7 @@ export default class VerificationPanel extends React.PureComponent { } catch (err) { console.error("error verify", err); } - } else if (this._hasVerifier && !request.verifier) { - request.verifier.removeListener('show_sas', this._onVerifierShowSas); } - this._hasVerifier = !!request.verifier; }; componentDidMount() { From 3590c97d96d0b9a739d266067d15999924b9178c Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 29 Jan 2020 15:24:06 +0100 Subject: [PATCH 3/4] unrelated fix: rerender hidden event tile when decrypted to get accurate type --- src/components/views/messages/ViewSourceEvent.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/views/messages/ViewSourceEvent.js b/src/components/views/messages/ViewSourceEvent.js index 62cf45fb6e..9064fc3b68 100644 --- a/src/components/views/messages/ViewSourceEvent.js +++ b/src/components/views/messages/ViewSourceEvent.js @@ -32,6 +32,13 @@ export default class ViewSourceEvent extends React.PureComponent { }; } + componentDidMount() { + const {mxEvent} = this.props; + if (mxEvent.isBeingDecrypted()) { + mxEvent.once("Event.decrypted", () => this.forceUpdate()); + } + } + onToggle = (ev) => { ev.preventDefault(); const { expanded } = this.state; From 44bc0d9fb19bddf39d44ec1192fe1c324dee87e2 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 29 Jan 2020 15:45:36 +0100 Subject: [PATCH 4/4] phase is a prop now --- src/components/views/right_panel/VerificationPanel.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/views/right_panel/VerificationPanel.js b/src/components/views/right_panel/VerificationPanel.js index a34dfbfdd0..e78f20c743 100644 --- a/src/components/views/right_panel/VerificationPanel.js +++ b/src/components/views/right_panel/VerificationPanel.js @@ -217,7 +217,6 @@ export default class VerificationPanel extends React.PureComponent { }; _onRequestChange = async () => { - this.forceUpdate(); const {request} = this.props; const hadVerifier = this._hasVerifier; this._hasVerifier = !!request.verifier;