From 776e63c0d898f3f7c9b5a08fcc4ccaf763a72002 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 15 Jun 2020 20:11:06 -0600 Subject: [PATCH] Handle/hide old rooms in the room list Fixes https://github.com/vector-im/riot-web/issues/14003 --- src/stores/room-list/RoomListStore2.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/stores/room-list/RoomListStore2.ts b/src/stores/room-list/RoomListStore2.ts index 1c4e66c4b0..9684e338f8 100644 --- a/src/stores/room-list/RoomListStore2.ts +++ b/src/stores/room-list/RoomListStore2.ts @@ -181,6 +181,12 @@ export class RoomListStore2 extends AsyncStore { const room = this.matrixClient.getRoom(roomId); const tryUpdate = async (updatedRoom: Room) => { console.log(`[RoomListDebug] Live timeline event ${eventPayload.event.getId()} in ${updatedRoom.roomId}`); + if (eventPayload.event.getType() === 'm.room.tombstone' && eventPayload.event.getStateKey() === '') { + console.log(`[RoomListDebug] Got tombstone event - regenerating room list`); + // TODO: We could probably be smarter about this + await this.regenerateAllLists(); + return; // don't pass the update down - we will have already handled it in the regen + } await this.handleRoomUpdate(updatedRoom, RoomUpdateCause.Timeline); }; if (!room) { @@ -334,7 +340,7 @@ export class RoomListStore2 extends AsyncStore { } await this.algorithm.populateTags(sorts, orders); - await this.algorithm.setKnownRooms(this.matrixClient.getRooms()); + await this.algorithm.setKnownRooms(this.matrixClient.getVisibleRooms()); this.initialListsGenerated = true;