From 2c28fa0568b196fd7e6147d12883a540761e3153 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 19 Dec 2019 16:08:53 +0000 Subject: [PATCH] use verif in right panel from "verify" button --- .../views/right_panel/EncryptionInfo.js | 4 ++-- .../views/right_panel/EncryptionPanel.js | 7 +++++++ src/components/views/right_panel/UserInfo.js | 15 ++++++++++++--- .../views/right_panel/VerificationPanel.js | 4 +++- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/components/views/right_panel/EncryptionInfo.js b/src/components/views/right_panel/EncryptionInfo.js index 88aa3f9a6c..f10d0b3499 100644 --- a/src/components/views/right_panel/EncryptionInfo.js +++ b/src/components/views/right_panel/EncryptionInfo.js @@ -21,9 +21,9 @@ export default class EncryptionInfo extends React.PureComponent { render() { const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); return (
-

End-to-end encryption is great!

+

End-to-end encryption is great! You should try it.

- Start verification + Start verification
); } diff --git a/src/components/views/right_panel/EncryptionPanel.js b/src/components/views/right_panel/EncryptionPanel.js index c37d4f2b61..9b32dba30e 100644 --- a/src/components/views/right_panel/EncryptionPanel.js +++ b/src/components/views/right_panel/EncryptionPanel.js @@ -20,6 +20,11 @@ import VerificationPanel from "./VerificationPanel"; import MatrixClientPeg from "../../../MatrixClientPeg"; export default class EncryptionPanel extends React.PureComponent { + constructor(props) { + super(props); + this.state = {}; + } + render() { const request = this.props.verificationRequest || this.state.verificationRequest; const {member} = this.props; @@ -27,6 +32,8 @@ export default class EncryptionPanel extends React.PureComponent { return ; } else if (member) { return ; + } else { + return

Not a member nor request, not sure what to render

; } } diff --git a/src/components/views/right_panel/UserInfo.js b/src/components/views/right_panel/UserInfo.js index 208c5e8906..542e010edd 100644 --- a/src/components/views/right_panel/UserInfo.js +++ b/src/components/views/right_panel/UserInfo.js @@ -40,6 +40,7 @@ import E2EIcon from "../rooms/E2EIcon"; import {useEventEmitter} from "../../../hooks/useEventEmitter"; import {textualPowerLevel} from '../../../Roles'; import MatrixClientContext from "../../../contexts/MatrixClientContext"; +import {RIGHT_PANEL_PHASES} from "../../../stores/RightPanelStorePhases"; const _disambiguateDevices = (devices) => { const names = Object.create(null); @@ -128,6 +129,14 @@ function verifyDevice(userId, device) { }, null, /* priority = */ false, /* static = */ true); } +function verifyUser(user) { + dis.dispatch({ + action: "set_right_panel_phase", + phase: RIGHT_PANEL_PHASES.EncryptionPanel, + refireParams: {member: user}, + }); +} + function DeviceItem({userId, device}) { const cli = useContext(MatrixClientContext); const deviceTrust = cli.checkDeviceTrust(userId, device.deviceId); @@ -1296,7 +1305,7 @@ const UserInfo = ({user, groupId, roomId, onClose}) => { const userVerified = cli.checkUserTrust(user.userId).isVerified(); let verifyButton; if (!userVerified) { - verifyButton = verifyDevice(user.userId, null)}> + verifyButton = verifyUser(user)}> {_t("Verify")} ; } @@ -1305,7 +1314,7 @@ const UserInfo = ({user, groupId, roomId, onClose}) => {

{ _t("Security") }

{ text }

- {verifyButton} + { verifyButton } { devicesSection }
); @@ -1323,7 +1332,7 @@ const UserInfo = ({user, groupId, roomId, onClose}) => {
-
+

{ e2eIcon } { displayName } diff --git a/src/components/views/right_panel/VerificationPanel.js b/src/components/views/right_panel/VerificationPanel.js index f73693a0ea..e1f36cbc0f 100644 --- a/src/components/views/right_panel/VerificationPanel.js +++ b/src/components/views/right_panel/VerificationPanel.js @@ -33,7 +33,7 @@ export default class VerificationPanel extends React.PureComponent { if (request.requested) { return (

Waiting for {request.otherUserId} to accept ...

); } else if (request.ready) { - return (

{request.otherUserId} is ready, start Verify by emoji

); + return (

{request.otherUserId} is ready, start Verify by emoji

); } else if (request.started) { if (this.state.sasEvent) { const VerificationShowSas = sdk.getComponent('views.verification.VerificationShowSas'); @@ -56,6 +56,8 @@ export default class VerificationPanel extends React.PureComponent { const verifier = this.props.request.beginKeyVerification(verificationMethods.SAS); try { await verifier.verify(); + } catch (err) { + console.error(err); } finally { this.setState({sasEvent: null}); }