Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 67824e9

Browse files
committed
Force update on timelinepanel when event decrypted
Partially fixes element-hq/element-web#4865 (the part about messages not appearing in the timeline until you move the cursor over the window). Requires matrix-org/matrix-js-sdk#529
1 parent 737a258 commit 67824e9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/components/structures/TimelinePanel.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ var TimelinePanel = React.createClass({
197197
MatrixClientPeg.get().on("Room.receipt", this.onRoomReceipt);
198198
MatrixClientPeg.get().on("Room.localEchoUpdated", this.onLocalEchoUpdated);
199199
MatrixClientPeg.get().on("Room.accountData", this.onAccountData);
200+
MatrixClientPeg.get().on("Event.decrypted", this.onEventDecrypted);
200201
MatrixClientPeg.get().on("sync", this.onSync);
201202

202203
this._initTimeline(this.props);
@@ -266,6 +267,7 @@ var TimelinePanel = React.createClass({
266267
client.removeListener("Room.receipt", this.onRoomReceipt);
267268
client.removeListener("Room.localEchoUpdated", this.onLocalEchoUpdated);
268269
client.removeListener("Room.accountData", this.onAccountData);
270+
client.removeListener("Event.decrypted", this.onEventDecrypted);
269271
client.removeListener("sync", this.onSync);
270272
}
271273
},
@@ -503,6 +505,16 @@ var TimelinePanel = React.createClass({
503505
}, this.props.onReadMarkerUpdated);
504506
},
505507

508+
onEventDecrypted: function(ev) {
509+
// Need to update as we don't display event tiles for events that
510+
// haven't yet been decrypted. The event will have just been updated
511+
// in place so we just need to re-render.
512+
// TODO: We should restrict this to only events in our timeline,
513+
// but possibly the event tile itself should just update when this
514+
// happens to save us re-rendering the whole timeline.
515+
this.forceUpdate();
516+
},
517+
506518
onSync: function(state, prevState, data) {
507519
this.setState({clientSyncState: state});
508520
},

0 commit comments

Comments
 (0)