From 5cc2361737608ec7875b46151ea84c5989e6e8d3 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 13 Jun 2018 15:52:50 +0100 Subject: [PATCH] change not_sent e2e lock to match colour of text Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .../{e2e-pending.svg => e2e-encrypting.svg} | 0 res/img/e2e-not_sent.svg | 12 ++++++ src/components/views/rooms/EventTile.js | 38 +++++++++++-------- 3 files changed, 34 insertions(+), 16 deletions(-) rename res/img/{e2e-pending.svg => e2e-encrypting.svg} (100%) create mode 100644 res/img/e2e-not_sent.svg diff --git a/res/img/e2e-pending.svg b/res/img/e2e-encrypting.svg similarity index 100% rename from res/img/e2e-pending.svg rename to res/img/e2e-encrypting.svg diff --git a/res/img/e2e-not_sent.svg b/res/img/e2e-not_sent.svg new file mode 100644 index 0000000000..fca79ae547 --- /dev/null +++ b/res/img/e2e-not_sent.svg @@ -0,0 +1,12 @@ + + + +48BF5D32-306C-4B20-88EB-24B1F743CAC9 +Created with sketchtool. + + + + + + + diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js index 50fe0928b0..9863a1c60a 100644 --- a/src/components/views/rooms/EventTile.js +++ b/src/components/views/rooms/EventTile.js @@ -443,25 +443,27 @@ module.exports = withMatrixClient(React.createClass({ const ev = this.props.mxEvent; const props = {onClick: this.onCryptoClicked}; + // event could not be decrypted if (ev.getContent().msgtype === 'm.bad.encrypted') { return ; - } else if (ev.isEncrypted()) { - if (this.state.verified) { - return ; - } else { - return ; - } - } else if (this.props.matrixClient.isRoomEncrypted(ev.getRoomId())) { + } + + // event is encrypted, display padlock corresponding to whether or not it is verified + if (ev.isEncrypted()) { + return this.state.verified ? : ; + } + + if (this.props.matrixClient.isRoomEncrypted(ev.getRoomId())) { // else if room is encrypted // and event is being encrypted or is not_sent (Unknown Devices/Network Error) - if (ev.status === EventStatus.ENCRYPTING || ev.status === EventStatus.NOT_SENT) { - // XXX: if the event is being encrypted (ie eventSendStatus === encrypting), - // it might be nice to show something other than the open padlock? - return ; - } else { - // if the event is not encrypted, but it's an e2e room, show the open padlock - return ; + if (ev.status === EventStatus.ENCRYPTING) { + return ; } + if (ev.status === EventStatus.NOT_SENT) { + return ; + } + // if the event is not encrypted, but it's an e2e room, show the open padlock + return ; } // no padlock needed @@ -736,8 +738,12 @@ function E2ePadlockUndecryptable(props) { ); } -function E2ePadlockPending(props) { - return ; +function E2ePadlockEncrypting(props) { + return ; +} + +function E2ePadlockNotSent(props) { + return ; } function E2ePadlockVerified(props) {