Update eventtiles when the events are decrypted

Events are sometimes decrypted after they arrive, so add an eventlistener for
it and update the tile.
pull/21833/head
Richard van der Hoff 2016-11-15 11:12:52 +00:00
parent 22757cfcd3
commit b209cc551e
1 changed files with 10 additions and 0 deletions

View File

@ -146,6 +146,7 @@ module.exports = WithMatrixClient(React.createClass({
this._suppressReadReceiptAnimation = false; this._suppressReadReceiptAnimation = false;
this.props.matrixClient.on("deviceVerificationChanged", this.props.matrixClient.on("deviceVerificationChanged",
this.onDeviceVerificationChanged); this.onDeviceVerificationChanged);
this.props.mxEvent.on("Event.decrypted", this._onDecrypted);
}, },
componentWillReceiveProps: function (nextProps) { componentWillReceiveProps: function (nextProps) {
@ -170,6 +171,15 @@ module.exports = WithMatrixClient(React.createClass({
var client = this.props.matrixClient; var client = this.props.matrixClient;
client.removeListener("deviceVerificationChanged", client.removeListener("deviceVerificationChanged",
this.onDeviceVerificationChanged); this.onDeviceVerificationChanged);
this.props.mxEvent.removeListener("Event.decrypted", this._onDecrypted);
},
/** called when the event is decrypted after we show it.
*/
_onDecrypted: function() {
// we need to re-verify the sending device.
this._verifyEvent(this.props.mxEvent);
this.forceUpdate();
}, },
onDeviceVerificationChanged: function(userId, device) { onDeviceVerificationChanged: function(userId, device) {