Make it possible in-code to hide rooms from the room list

Fixes https://github.com/vector-im/element-web/issues/15745

This was surprisingly easy given the number of errors I remember last time, but here it is. This also includes an over-engineered VisibilityProvider with the intention that it'll get used in the future for things like Spaces and other X as Rooms stuff.
This commit is contained in:
Travis Ralston 2020-11-25 19:42:57 -07:00
parent 1db130b8f0
commit b9af446c1b
4 changed files with 112 additions and 1 deletions

View file

@ -34,6 +34,7 @@ import { MarkedExecution } from "../../utils/MarkedExecution";
import { AsyncStoreWithClient } from "../AsyncStoreWithClient";
import { NameFilterCondition } from "./filters/NameFilterCondition";
import { RoomNotificationStateStore } from "../notifications/RoomNotificationStateStore";
import { VisibilityProvider } from "./filters/VisibilityProvider";
interface IState {
tagsEnabled?: boolean;
@ -544,7 +545,8 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
public async regenerateAllLists({trigger = true}) {
console.warn("Regenerating all room lists");
const rooms = this.matrixClient.getVisibleRooms();
const rooms = this.matrixClient.getVisibleRooms()
.filter(r => VisibilityProvider.instance.isRoomVisible(r));
const customTags = new Set<TagID>();
if (this.state.tagsEnabled) {
for (const room of rooms) {