diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js
index b3831a7d0d..815f0a3c6a 100644
--- a/src/components/views/rooms/EventTile.js
+++ b/src/components/views/rooms/EventTile.js
@@ -155,7 +155,9 @@ module.exports = withMatrixClient(React.createClass({
},
componentWillReceiveProps: function(nextProps) {
- if (nextProps.mxEvent !== this.props.mxEvent) {
+ // re-check the sender verification as outgoing events progress through
+ // the send process.
+ if (nextProps.eventSendStatus !== this.props.eventSendStatus) {
this._verifyEvent(nextProps.mxEvent);
}
},
@@ -386,6 +388,36 @@ module.exports = withMatrixClient(React.createClass({
});
},
+ _renderE2EPadlock: function() {
+ const ev = this.props.mxEvent;
+ const props = {onClick: this.onCryptoClicked};
+
+
+ if (ev.getContent().msgtype === 'm.bad.encrypted') {
+ return ;
+ } else if (ev.isEncrypted()) {
+ if (this.state.verified) {
+ return ;
+ } 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) {
+ return ;
+ }
+ }
+
+ // no padlock needed
+ return null;
+ },
+
render: function() {
var MessageTimestamp = sdk.getComponent('messages.MessageTimestamp');
var SenderProfile = sdk.getComponent('messages.SenderProfile');
@@ -407,7 +439,6 @@ module.exports = withMatrixClient(React.createClass({
throw new Error("Event type not supported");
}
- var e2eEnabled = this.props.matrixClient.isRoomEncrypted(this.props.mxEvent.getRoomId());
var isSending = (['sending', 'queued', 'encrypting'].indexOf(this.props.eventSendStatus) !== -1);
const isRedacted = (eventType === 'm.room.message') && this.props.isRedacted;
@@ -485,26 +516,7 @@ module.exports = withMatrixClient(React.createClass({
const editButton = (
);
- let e2e;
- // cosmetic padlocks:
- if ((e2eEnabled && this.props.eventSendStatus) || this.props.mxEvent.getType() === 'm.room.encryption') {
- e2e = ;
- }
- // real padlocks
- else if (this.props.mxEvent.isEncrypted() || (e2eEnabled && this.props.eventSendStatus)) {
- if (this.props.mxEvent.getContent().msgtype === 'm.bad.encrypted') {
- e2e = ;
- }
- else if (this.state.verified == true || (e2eEnabled && this.props.eventSendStatus)) {
- e2e = ;
- }
- else {
- e2e = ;
- }
- }
- else if (e2eEnabled) {
- e2e = ;
- }
+
const timestamp = this.props.mxEvent.getTs() ?
: null;
@@ -572,7 +584,7 @@ module.exports = withMatrixClient(React.createClass({
{ timestamp }
- { e2e }
+ { this._renderE2EPadlock() }
+ );
+}
+
+function E2ePadlockVerified(props) {
+ return (
+
+ );
+}
+
+function E2ePadlockUnverified(props) {
+ return (
+
+ );
+}
+
+function E2ePadlockUnencrypted(props) {
+ return (
+
+ );
+}
+
+function E2ePadlock(props) {
+ return ;
+}