fix message appears unencrypted while in flight

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2018-06-13 13:51:04 +01:00
parent e858cf3bcb
commit d4b2f06a63
No known key found for this signature in database
GPG key ID: 3F879DA5AD802A5E
2 changed files with 26 additions and 10 deletions

View file

@ -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 <E2ePadlockUndecryptable {...props} />;
} else if (ev.isEncrypted()) {
@ -451,15 +451,15 @@ module.exports = withMatrixClient(React.createClass({
} else {
return <E2ePadlockUnverified {...props} />;
}
} 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 <E2ePadlockPending {...props} />;
} else {
// if the event is not encrypted, but it's an e2e room, show the open padlock
return <E2ePadlockUnencrypted {...props} />;
}
}
@ -736,6 +736,10 @@ function E2ePadlockUndecryptable(props) {
);
}
function E2ePadlockPending(props) {
return <E2ePadlock alt={_t('Encrypting')} src="img/e2e-pending.svg" width="10" height="12" {...props} />;
}
function E2ePadlockVerified(props) {
return (
<E2ePadlock alt={_t("Encrypted by a verified device")}