Merge pull request #4767 from matrix-org/travis/room-list/tombstone

Handle/hide old rooms in the room list
pull/21833/head
Travis Ralston 2020-06-17 08:24:27 -06:00 committed by GitHub
commit 07f13f2ece
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -181,6 +181,12 @@ export class RoomListStore2 extends AsyncStore<ActionPayload> {
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<ActionPayload> {
}
await this.algorithm.populateTags(sorts, orders);
await this.algorithm.setKnownRooms(this.matrixClient.getRooms());
await this.algorithm.setKnownRooms(this.matrixClient.getVisibleRooms());
this.initialListsGenerated = true;