RoomListStoreV3: Only add new rooms that pass VisibilityProvider check (#29974)
* Add new rooms only after checking VisibilityProvider Otherwise we might end up adding space rooms and other rooms that must be hidden. * Write test
This commit is contained in:
@@ -321,8 +321,17 @@ export class RoomListStoreV3Class extends AsyncStoreWithClient<EmptyObject> {
|
||||
*/
|
||||
private addRoomAndEmit(room: Room, isNewRoom = false): void {
|
||||
if (!this.roomSkipList) throw new Error("roomSkipList hasn't been created yet!");
|
||||
if (isNewRoom) this.roomSkipList.addNewRoom(room);
|
||||
else this.roomSkipList.reInsertRoom(room);
|
||||
if (isNewRoom) {
|
||||
if (!VisibilityProvider.instance.isRoomVisible(room)) {
|
||||
logger.info(
|
||||
`RoomListStoreV3: Refusing to add new room ${room.roomId} because isRoomVisible returned false.`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
this.roomSkipList.addNewRoom(room);
|
||||
} else {
|
||||
this.roomSkipList.reInsertRoom(room);
|
||||
}
|
||||
this.emit(LISTS_UPDATE_EVENT);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user