From cdbd4da0e4e45d8fa64b5458f3f226d74ac5862a Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 3 Apr 2020 17:04:29 +0200 Subject: [PATCH] adjust copy for self-verification in verification panel --- .../views/right_panel/VerificationPanel.js | 38 ++++++++++++------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/src/components/views/right_panel/VerificationPanel.js b/src/components/views/right_panel/VerificationPanel.js index e114b60b28..b60cc234eb 100644 --- a/src/components/views/right_panel/VerificationPanel.js +++ b/src/components/views/right_panel/VerificationPanel.js @@ -18,7 +18,6 @@ import React from "react"; import PropTypes from "prop-types"; import * as sdk from '../../../index'; -import {MatrixClientPeg} from '../../../MatrixClientPeg'; import {verificationMethods} from 'matrix-js-sdk/src/crypto'; import {SCAN_QR_CODE_METHOD} from "matrix-js-sdk/src/crypto/verification/QRCode"; @@ -200,13 +199,15 @@ export default class VerificationPanel extends React.PureComponent { } renderVerifiedPhase() { - const {member} = this.props; + const {member, request} = this.props; let text; - if (this.props.isRoomEncrypted) { - text = _t("Verify all users in a room to ensure it's secure."); - } else { - text = _t("In encrypted rooms, verify all users to ensure it’s secure."); + if (!request.isSelfVerification) { + if (this.props.isRoomEncrypted) { + text = _t("Verify all users in a room to ensure it's secure."); + } else { + text = _t("In encrypted rooms, verify all users to ensure it’s secure."); + } } const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); @@ -224,8 +225,7 @@ export default class VerificationPanel extends React.PureComponent {

{_t("Verified")}

{description}

-

{ text }

- + { text ?

{ text }

: null } {_t("Got it")} @@ -238,15 +238,27 @@ export default class VerificationPanel extends React.PureComponent { const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); + let startAgainInstruction; + if (request.isSelfVerification) { + startAgainInstruction = _t("Start verification again from the notification."); + } else { + startAgainInstruction = _t("Start verification again from their profile."); + } + let text; if (request.cancellationCode === "m.timeout") { - text = _t("Verification timed out. Start verification again from their profile."); + text = _t("Verification timed out.") + ` ${startAgainInstruction}`; } else if (request.cancellingUserId === request.otherUserId) { - text = _t("%(displayName)s cancelled verification. Start verification again from their profile.", { - displayName: member.displayName || member.name || member.userId, - }); + if (request.isSelfVerification) { + text = _t("You cancelled verification on your other session."); + } else { + text = _t("%(displayName)s cancelled verification.", { + displayName: member.displayName || member.name || member.userId, + }); + } + text = `${text} ${startAgainInstruction}`; } else { - text = _t("You cancelled verification. Start verification again from their profile."); + text = _t("You cancelled verification.") + ` ${startAgainInstruction}`; } return (