From d4b2f06a63a65e4897d6cbbb6a46df22be933b83 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Wed, 13 Jun 2018 13:51:04 +0100
Subject: [PATCH] fix message appears unencrypted while in flight
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
res/img/e2e-pending.svg | 12 ++++++++++++
src/components/views/rooms/EventTile.js | 24 ++++++++++++++----------
2 files changed, 26 insertions(+), 10 deletions(-)
create mode 100644 res/img/e2e-pending.svg
diff --git a/res/img/e2e-pending.svg b/res/img/e2e-pending.svg
new file mode 100644
index 0000000000..469611cc8d
--- /dev/null
+++ b/res/img/e2e-pending.svg
@@ -0,0 +1,12 @@
+
+
diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js
index 589524bb9e..50fe0928b0 100644
--- a/src/components/views/rooms/EventTile.js
+++ b/src/components/views/rooms/EventTile.js
@@ -34,6 +34,7 @@ const ContextualMenu = require('../../structures/ContextualMenu');
import dis from '../../../dispatcher';
import {makeEventPermalink} from "../../../matrix-to";
import SettingsStore from "../../../settings/SettingsStore";
+import {EventStatus} from 'matrix-js-sdk';
const ObjectUtils = require('../../../ObjectUtils');
@@ -442,7 +443,6 @@ module.exports = withMatrixClient(React.createClass({
const ev = this.props.mxEvent;
const props = {onClick: this.onCryptoClicked};
-
if (ev.getContent().msgtype === 'm.bad.encrypted') {
return ;
} else if (ev.isEncrypted()) {
@@ -451,15 +451,15 @@ module.exports = withMatrixClient(React.createClass({
} else {
return ;
}
- } else {
- // XXX: if the event is being encrypted (ie eventSendStatus ===
- // encrypting), it might be nice to show something other than the
- // open padlock?
-
- // if the event is not encrypted, but it's an e2e room, show the
- // open padlock
- const e2eEnabled = this.props.matrixClient.isRoomEncrypted(ev.getRoomId());
- if (e2eEnabled) {
+ } else 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 ;
}
}
@@ -736,6 +736,10 @@ function E2ePadlockUndecryptable(props) {
);
}
+function E2ePadlockPending(props) {
+ return ;
+}
+
function E2ePadlockVerified(props) {
return (