From 569d5b6156fee2e353ee02ac96feac548a812b3f Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 25 Feb 2020 13:13:31 +0100 Subject: [PATCH 1/5] show right panel before waiting for .ready event to send --- src/components/views/toasts/VerificationRequestToast.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/toasts/VerificationRequestToast.js b/src/components/views/toasts/VerificationRequestToast.js index 4a881ae852..c11cefc839 100644 --- a/src/components/views/toasts/VerificationRequestToast.js +++ b/src/components/views/toasts/VerificationRequestToast.js @@ -78,7 +78,6 @@ export default class VerificationRequestToast extends React.PureComponent { // no room id for to_device requests const cli = MatrixClientPeg.get(); try { - await request.accept(); if (request.channel.roomId) { dis.dispatch({ action: 'view_room', @@ -99,6 +98,7 @@ export default class VerificationRequestToast extends React.PureComponent { verificationRequest: request, }, null, /* priority = */ false, /* static = */ true); } + await request.accept(); } catch (err) { console.error(err.message); } From 2127edb7b8007092ec30648db0e0f8ebba3253c8 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 25 Feb 2020 13:13:51 +0100 Subject: [PATCH 2/5] show "Waiting for network" in EncryptionInfo after accepting in toast --- .../views/right_panel/EncryptionInfo.js | 15 ++++++++++----- .../views/right_panel/EncryptionPanel.js | 7 ++++++- src/i18n/strings/en_EN.json | 1 + 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/components/views/right_panel/EncryptionInfo.js b/src/components/views/right_panel/EncryptionInfo.js index 299e553769..3638e1058f 100644 --- a/src/components/views/right_panel/EncryptionInfo.js +++ b/src/components/views/right_panel/EncryptionInfo.js @@ -28,12 +28,17 @@ export const PendingActionSpinner = ({text}) => { ; }; -const EncryptionInfo = ({pending, member, onStartVerification}) => { +const EncryptionInfo = ({waitingForOtherParty, waitingForNetwork, member, onStartVerification}) => { let content; - if (pending) { - const text = _t("Waiting for %(displayName)s to accept…", { - displayName: member.displayName || member.name || member.userId, - }); + if (waitingForOtherParty || waitingForNetwork) { + let text; + if (waitingForOtherParty) { + text = _t("Waiting for %(displayName)s to accept…", { + displayName: member.displayName || member.name || member.userId, + }); + } else { + text = _t("Waiting for network…"); + } content = ; } else { const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); diff --git a/src/components/views/right_panel/EncryptionPanel.js b/src/components/views/right_panel/EncryptionPanel.js index 24d2f9f010..3ba6ca9a8a 100644 --- a/src/components/views/right_panel/EncryptionPanel.js +++ b/src/components/views/right_panel/EncryptionPanel.js @@ -76,8 +76,13 @@ const EncryptionPanel = ({verificationRequest, member, onClose, layout}) => { }, [member.userId]); const requested = request && (phase === PHASE_REQUESTED || phase === PHASE_UNSENT || phase === undefined); + const initiatedByMe = request && request.initiatedByMe; if (!request || requested) { - return ; + return ; } else { return ( Date: Tue, 25 Feb 2020 13:18:27 +0100 Subject: [PATCH 3/5] UI spinner when clicking "they don't match" --- .../views/verification/VerificationShowSas.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/components/views/verification/VerificationShowSas.js b/src/components/views/verification/VerificationShowSas.js index 4d3c962385..ea81ef3d65 100644 --- a/src/components/views/verification/VerificationShowSas.js +++ b/src/components/views/verification/VerificationShowSas.js @@ -48,6 +48,11 @@ export default class VerificationShowSas extends React.Component { this.props.onDone(); }; + onDontMatchClick = () => { + this.setState({ cancelling: true }); + this.props.onCancel(); + }; + render() { let sasDisplay; let sasCaption; @@ -98,9 +103,14 @@ export default class VerificationShowSas extends React.Component { } let confirm; - if (this.state.pending) { - const {displayName} = this.props; - const text = _t("Waiting for %(displayName)s to verify…", {displayName}); + if (this.state.pending || this.state.cancelling) { + let text; + if (this.state.pending) { + const {displayName} = this.props; + text = _t("Waiting for %(displayName)s to verify…", {displayName}); + } else { + text = _t("Waiting for network…"); + } confirm = ; } else { // FIXME: stop using DialogButtons here once this component is only used in the right panel verification @@ -109,7 +119,7 @@ export default class VerificationShowSas extends React.Component { onPrimaryButtonClick={this.onMatchClick} primaryButtonClass="mx_UserInfo_wideButton" cancelButton={_t("They don't match")} - onCancel={this.props.onCancel} + onCancel={this.onDontMatchClick} cancelButtonClass="mx_UserInfo_wideButton" />; } From bd584ab23651ac29eaeb445b1a36844ffb328f0f Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 25 Feb 2020 13:27:19 +0100 Subject: [PATCH 4/5] from verification tile, also don't wait to show right panel --- src/components/views/messages/MKeyVerificationRequest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/messages/MKeyVerificationRequest.js b/src/components/views/messages/MKeyVerificationRequest.js index d02319119e..df1e14a717 100644 --- a/src/components/views/messages/MKeyVerificationRequest.js +++ b/src/components/views/messages/MKeyVerificationRequest.js @@ -62,8 +62,8 @@ export default class MKeyVerificationRequest extends React.Component { const request = this.props.mxEvent.verificationRequest; if (request) { try { - await request.accept(); this._openRequest(); + await request.accept(); } catch (err) { console.error(err.message); } From 682781aa48fb4f2b41ebae6662cd24628c33ddce Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 25 Feb 2020 13:27:59 +0100 Subject: [PATCH 5/5] better word smithing --- src/components/views/messages/MKeyVerificationRequest.js | 4 ++-- src/components/views/right_panel/EncryptionInfo.js | 2 +- src/components/views/verification/VerificationShowSas.js | 2 +- src/i18n/strings/en_EN.json | 7 ++++--- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/components/views/messages/MKeyVerificationRequest.js b/src/components/views/messages/MKeyVerificationRequest.js index df1e14a717..f49ae1b6b1 100644 --- a/src/components/views/messages/MKeyVerificationRequest.js +++ b/src/components/views/messages/MKeyVerificationRequest.js @@ -136,9 +136,9 @@ export default class MKeyVerificationRequest extends React.Component { } else if (request.cancelled) { stateLabel = this._cancelledLabel(request.cancellingUserId); } else if (request.accepting) { - stateLabel = _t("accepting …"); + stateLabel = _t("Accepting …"); } else if (request.declining) { - stateLabel = _t("declining …"); + stateLabel = _t("Declining …"); } stateNode = (
{stateLabel}
); } diff --git a/src/components/views/right_panel/EncryptionInfo.js b/src/components/views/right_panel/EncryptionInfo.js index 3638e1058f..bbedc9b303 100644 --- a/src/components/views/right_panel/EncryptionInfo.js +++ b/src/components/views/right_panel/EncryptionInfo.js @@ -37,7 +37,7 @@ const EncryptionInfo = ({waitingForOtherParty, waitingForNetwork, member, onStar displayName: member.displayName || member.name || member.userId, }); } else { - text = _t("Waiting for network…"); + text = _t("Accepting…"); } content = ; } else { diff --git a/src/components/views/verification/VerificationShowSas.js b/src/components/views/verification/VerificationShowSas.js index ea81ef3d65..e640a75129 100644 --- a/src/components/views/verification/VerificationShowSas.js +++ b/src/components/views/verification/VerificationShowSas.js @@ -109,7 +109,7 @@ export default class VerificationShowSas extends React.Component { const {displayName} = this.props; text = _t("Waiting for %(displayName)s to verify…", {displayName}); } else { - text = _t("Waiting for network…"); + text = _t("Cancelling…"); } confirm = ; } else { diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 6192302d18..3b2bca49a3 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -465,6 +465,7 @@ "Verify this user by confirming the following number appears on their screen.": "Verify this user by confirming the following number appears on their screen.", "Unable to find a supported verification method.": "Unable to find a supported verification method.", "Waiting for %(displayName)s to verify…": "Waiting for %(displayName)s to verify…", + "Cancelling…": "Cancelling…", "They match": "They match", "They don't match": "They don't match", "To be secure, do this in person or use a trusted way to communicate.": "To be secure, do this in person or use a trusted way to communicate.", @@ -1165,7 +1166,7 @@ "In encrypted rooms, like this one, URL previews are disabled by default to ensure that your homeserver (where the previews are generated) cannot gather information about links you see in this room.": "In encrypted rooms, like this one, URL previews are disabled by default to ensure that your homeserver (where the previews are generated) cannot gather information about links you see in this room.", "When someone puts a URL in their message, a URL preview can be shown to give more information about that link such as the title, description, and an image from the website.": "When someone puts a URL in their message, a URL preview can be shown to give more information about that link such as the title, description, and an image from the website.", "Waiting for %(displayName)s to accept…": "Waiting for %(displayName)s to accept…", - "Waiting for network…": "Waiting for network…", + "Accepting…": "Accepting…", "Start Verification": "Start Verification", "Messages in this room are end-to-end encrypted.": "Messages in this room are end-to-end encrypted.", "Your messages are secured and only you and the recipient have the unique keys to unlock them.": "Your messages are secured and only you and the recipient have the unique keys to unlock them.", @@ -1249,8 +1250,8 @@ "You cancelled": "You cancelled", "%(name)s declined": "%(name)s declined", "%(name)s cancelled": "%(name)s cancelled", - "accepting …": "accepting …", - "declining …": "declining …", + "Accepting …": "Accepting …", + "Declining …": "Declining …", "%(name)s wants to verify": "%(name)s wants to verify", "You sent a verification request": "You sent a verification request", "Error decrypting video": "Error decrypting video",