Merge pull request #5560 from matrix-org/dbkr/voip_user_mapper

Add VoIP user mapper
This commit is contained in:
David Baker 2021-01-22 14:12:08 +00:00 committed by GitHub
commit f703383ab6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 171 additions and 32 deletions

View file

@ -16,6 +16,7 @@
import {Room} from "matrix-js-sdk/src/models/room";
import { RoomListCustomisations } from "../../../customisations/RoomList";
import { isVirtualRoom, voipUserMapperEnabled } from "../../../VoipUserMapper";
export class VisibilityProvider {
private static internalInstance: VisibilityProvider;
@ -31,18 +32,13 @@ export class VisibilityProvider {
}
public isRoomVisible(room: Room): boolean {
/* eslint-disable prefer-const */
let isVisible = true; // Returned at the end of this function
let forced = false; // When true, this function won't bother calling the customisation points
/* eslint-enable prefer-const */
// ------
// TODO: The `if` statements to control visibility of custom room types
// would go here. The remainder of this function assumes that the statements
// will be here.
//
// When removing this comment block, please remove the lint disable lines in the area.
// ------
if (voipUserMapperEnabled() && isVirtualRoom(room.roomId)) {
isVisible = false;
forced = true;
}
const isVisibleFn = RoomListCustomisations.isRoomVisible;
if (!forced && isVisibleFn) {