First special treatment of space-rooms

This commit is contained in:
Michael Telatynski 2021-02-19 14:20:57 +00:00
parent 6b3f05a3cd
commit 79daf615e4
4 changed files with 15 additions and 8 deletions

View file

@ -122,6 +122,7 @@ export class BreadcrumbsStore extends AsyncStoreWithClient<IState> {
}
private async appendRoom(room: Room) {
if (room.isSpaceRoom() && SettingsStore.getValue("feature_spaces")) return; // hide space rooms
let updated = false;
const rooms = (this.state.rooms || []).slice(); // cheap clone

View file

@ -18,6 +18,7 @@ import {Room} from "matrix-js-sdk/src/models/room";
import CallHandler from "../../../CallHandler";
import { RoomListCustomisations } from "../../../customisations/RoomList";
import VoipUserMapper from "../../../VoipUserMapper";
import SettingsStore from "../../../settings/SettingsStore";
export class VisibilityProvider {
private static internalInstance: VisibilityProvider;
@ -37,22 +38,23 @@ export class VisibilityProvider {
}
public isRoomVisible(room: Room): boolean {
let isVisible = true; // Returned at the end of this function
let forced = false; // When true, this function won't bother calling the customisation points
if (
CallHandler.sharedInstance().getSupportsVirtualRooms() &&
VoipUserMapper.sharedInstance().isVirtualRoom(room)
) {
isVisible = false;
forced = true;
return false;
}
// hide space rooms as they'll be shown in the SpacePanel
if (room.isSpaceRoom() && SettingsStore.getValue("feature_spaces")) {
return false;
}
const isVisibleFn = RoomListCustomisations.isRoomVisible;
if (!forced && isVisibleFn) {
isVisible = isVisibleFn(room);
if (isVisibleFn) {
return isVisibleFn(room);
}
return isVisible;
return true; // default
}
}