Skip to content

Commit 776e63c

Browse files
committed
Handle/hide old rooms in the room list
Fixes element-hq/element-web#14003
1 parent 94f52c4 commit 776e63c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/stores/room-list/RoomListStore2.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@ export class RoomListStore2 extends AsyncStore<ActionPayload> {
181181
const room = this.matrixClient.getRoom(roomId);
182182
const tryUpdate = async (updatedRoom: Room) => {
183183
console.log(`[RoomListDebug] Live timeline event ${eventPayload.event.getId()} in ${updatedRoom.roomId}`);
184+
if (eventPayload.event.getType() === 'm.room.tombstone' && eventPayload.event.getStateKey() === '') {
185+
console.log(`[RoomListDebug] Got tombstone event - regenerating room list`);
186+
// TODO: We could probably be smarter about this
187+
await this.regenerateAllLists();
188+
return; // don't pass the update down - we will have already handled it in the regen
189+
}
184190
await this.handleRoomUpdate(updatedRoom, RoomUpdateCause.Timeline);
185191
};
186192
if (!room) {
@@ -334,7 +340,7 @@ export class RoomListStore2 extends AsyncStore<ActionPayload> {
334340
}
335341

336342
await this.algorithm.populateTags(sorts, orders);
337-
await this.algorithm.setKnownRooms(this.matrixClient.getRooms());
343+
await this.algorithm.setKnownRooms(this.matrixClient.getVisibleRooms());
338344

339345
this.initialListsGenerated = true;
340346

0 commit comments

Comments
 (0)