From 3a1159ce12779ca389296bd12125708d9080dd6d Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Mon, 12 Sep 2016 01:37:51 +0100 Subject: [PATCH] e2e look & feel --- src/components/views/rooms/EventTile.js | 34 ++++++++++++++----- src/components/views/rooms/MessageComposer.js | 7 ++++ 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js index 702cf94a68..07981be141 100644 --- a/src/components/views/rooms/EventTile.js +++ b/src/components/views/rooms/EventTile.js @@ -248,8 +248,7 @@ module.exports = React.createClass({ if (!actions || !actions.tweaks) { return false; } // don't show self-highlights from another of our clients - if (this.props.mxEvent.sender && - this.props.mxEvent.sender.userId === MatrixClientPeg.get().credentials.userId) + if (this.props.mxEvent.getSender() === MatrixClientPeg.get().credentials.userId) { return false; } @@ -384,21 +383,24 @@ module.exports = React.createClass({ throw new Error("Event type not supported"); } + var e2eEnabled = MatrixClientPeg.get().isRoomEncrypted(this.props.mxEvent.getRoomId()); + var isSending = (['sending', 'queued', 'encrypting'].indexOf(this.props.eventSendStatus) !== -1); + var classes = classNames({ mx_EventTile: true, mx_EventTile_info: isInfoMessage, - mx_EventTile_sending: ['sending', 'queued'].indexOf( - this.props.eventSendStatus - ) !== -1, + mx_EventTile_encrypting: this.props.eventSendStatus == 'encrypting', + mx_EventTile_sending: isSending, mx_EventTile_notSent: this.props.eventSendStatus == 'not_sent', - mx_EventTile_highlight: this.props.tileShape === 'notif' ? false : this.shouldHighlight(), + mx_EventTile_highlight: this.props.tileShape == 'notif' ? false : this.shouldHighlight(), mx_EventTile_selected: this.props.isSelectedEvent, mx_EventTile_continuation: this.props.tileShape ? '' : this.props.continuation, mx_EventTile_last: this.props.last, mx_EventTile_contextual: this.props.contextual, menu: this.state.menu, - mx_EventTile_verified: this.state.verified == true, + mx_EventTile_verified: this.state.verified == true || (e2eEnabled && isSending), mx_EventTile_unverified: this.state.verified == false, + mx_EventTile_bad: this.props.mxEvent.getContent().msgtype === 'm.bad.encrypted', }); var permalink = "#/room/" + this.props.mxEvent.getRoomId() +"/"+ this.props.mxEvent.getId(); @@ -447,13 +449,28 @@ module.exports = React.createClass({ else { sender = ; } - } var editButton = ( Options ); + var e2e; + if (e2eEnabled) { + if (this.props.mxEvent.getContent().msgtype === 'm.bad.encrypted') { + e2e = ; + } + else if (this.state.verified == true) { + e2e = Encrypted by a verified device; + } + else if (this.state.verified == false) { + e2e = Encrypted by an unverified device!; + } + else { + e2e = ; + } + } + if (this.props.tileShape === "notif") { var room = MatrixClientPeg.get().getRoom(this.props.mxEvent.getRoomId()); @@ -515,6 +532,7 @@ module.exports = React.createClass({ + { e2e } ); + if (MatrixClientPeg.get().isRoomEncrypted(this.props.room.roomId)) { + // FIXME: show a /!\ if there are untrusted devices in the room... + controls.push( + Encrypted room + ); + } + var callButton, videoCallButton, hangupButton; if (this.props.callState && this.props.callState !== 'ended') { hangupButton =