Reorder the RoomListStore lists on Event.decrypted

This commit is contained in:
Luke Barnard 2018-02-23 10:32:33 +00:00
parent 663c7e5285
commit 9e969e33b7
2 changed files with 35 additions and 0 deletions

View file

@ -87,6 +87,20 @@ class RoomListStore extends Store {
this._generateRoomLists();
}
break;
// When an event is decrypted, it could mean we need to reorder the room
// list because we now know the type of the event.
case 'MatrixActions.Event.decrypted': {
const room = this._matrixClient.getRoom(payload.event.getRoomId());
const liveTimeline = room.getLiveTimeline();
const eventTimeline = room.getTimelineForEvent(payload.event.getId());
if (!this._state.ready ||
liveTimeline !== eventTimeline ||
!this._eventTriggersRecentReorder(payload.event)
) break;
this._generateRoomLists();
}
break;
case 'MatrixActions.accountData': {
if (payload.event_type !== 'm.direct') break;
this._generateRoomLists();