First special treatment of space-rooms

pull/21833/head
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

@ -165,6 +165,9 @@ export function avatarUrlForRoom(room: Room, width: number, height: number, resi
return explicitRoomAvatar; return explicitRoomAvatar;
} }
// space rooms cannot be DMs so skip the rest
if (room.isSpaceRoom()) return null;
let otherMember = null; let otherMember = null;
const otherUserId = DMRoomMap.shared().getUserIdForRoomId(room.roomId); const otherUserId = DMRoomMap.shared().getUserIdForRoomId(room.roomId);
if (otherUserId) { if (otherUserId) {

View File

@ -777,6 +777,7 @@
"%(senderName)s: %(reaction)s": "%(senderName)s: %(reaction)s", "%(senderName)s: %(reaction)s": "%(senderName)s: %(reaction)s",
"%(senderName)s: %(stickerName)s": "%(senderName)s: %(stickerName)s", "%(senderName)s: %(stickerName)s": "%(senderName)s: %(stickerName)s",
"Change notification settings": "Change notification settings", "Change notification settings": "Change notification settings",
"Spaces prototype. Incompatible with Communities, Communities v2 and Custom Tags": "Spaces prototype. Incompatible with Communities, Communities v2 and Custom Tags",
"Render LaTeX maths in messages": "Render LaTeX maths in messages", "Render LaTeX maths in messages": "Render LaTeX maths in messages",
"Communities v2 prototypes. Requires compatible homeserver. Highly experimental - use with caution.": "Communities v2 prototypes. Requires compatible homeserver. Highly experimental - use with caution.", "Communities v2 prototypes. Requires compatible homeserver. Highly experimental - use with caution.": "Communities v2 prototypes. Requires compatible homeserver. Highly experimental - use with caution.",
"New spinner design": "New spinner design", "New spinner design": "New spinner design",

View File

@ -122,6 +122,7 @@ export class BreadcrumbsStore extends AsyncStoreWithClient<IState> {
} }
private async appendRoom(room: Room) { private async appendRoom(room: Room) {
if (room.isSpaceRoom() && SettingsStore.getValue("feature_spaces")) return; // hide space rooms
let updated = false; let updated = false;
const rooms = (this.state.rooms || []).slice(); // cheap clone 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 CallHandler from "../../../CallHandler";
import { RoomListCustomisations } from "../../../customisations/RoomList"; import { RoomListCustomisations } from "../../../customisations/RoomList";
import VoipUserMapper from "../../../VoipUserMapper"; import VoipUserMapper from "../../../VoipUserMapper";
import SettingsStore from "../../../settings/SettingsStore";
export class VisibilityProvider { export class VisibilityProvider {
private static internalInstance: VisibilityProvider; private static internalInstance: VisibilityProvider;
@ -37,22 +38,23 @@ export class VisibilityProvider {
} }
public isRoomVisible(room: Room): boolean { 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 ( if (
CallHandler.sharedInstance().getSupportsVirtualRooms() && CallHandler.sharedInstance().getSupportsVirtualRooms() &&
VoipUserMapper.sharedInstance().isVirtualRoom(room) VoipUserMapper.sharedInstance().isVirtualRoom(room)
) { ) {
isVisible = false; return false;
forced = true; }
// hide space rooms as they'll be shown in the SpacePanel
if (room.isSpaceRoom() && SettingsStore.getValue("feature_spaces")) {
return false;
} }
const isVisibleFn = RoomListCustomisations.isRoomVisible; const isVisibleFn = RoomListCustomisations.isRoomVisible;
if (!forced && isVisibleFn) { if (isVisibleFn) {
isVisible = isVisibleFn(room); return isVisibleFn(room);
} }
return isVisible; return true; // default
} }
} }