Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Avatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ export function avatarUrlForRoom(room: Room, width: number, height: number, resi
return explicitRoomAvatar;
}

// space rooms cannot be DMs so skip the rest
if (room.isSpaceRoom()) return null;

let otherMember = null;
const otherUserId = DMRoomMap.shared().getUserIdForRoomId(room.roomId);
if (otherUserId) {
Expand Down
1 change: 1 addition & 0 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,7 @@
"%(senderName)s: %(reaction)s": "%(senderName)s: %(reaction)s",
"%(senderName)s: %(stickerName)s": "%(senderName)s: %(stickerName)s",
"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",
"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",
Expand Down
10 changes: 10 additions & 0 deletions src/settings/Settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ export interface ISetting {
}

export const SETTINGS: {[setting: string]: ISetting} = {
"feature_spaces": {
isFeature: true,
displayName: _td("Spaces prototype. Incompatible with Communities, Communities v2 and Custom Tags"),
supportedLevels: LEVELS_FEATURE,
default: false,
controller: new ReloadOnChangeController(),
},
"feature_latex_maths": {
isFeature: true,
displayName: _td("Render LaTeX maths in messages"),
Expand All @@ -134,6 +141,7 @@ export const SETTINGS: {[setting: string]: ISetting} = {
),
supportedLevels: LEVELS_FEATURE,
default: false,
controller: new IncompatibleController("feature_spaces"),
},
"feature_new_spinner": {
isFeature: true,
Expand All @@ -159,6 +167,7 @@ export const SETTINGS: {[setting: string]: ISetting} = {
displayName: _td("Group & filter rooms by custom tags (refresh to apply changes)"),
supportedLevels: LEVELS_FEATURE,
default: false,
controller: new IncompatibleController("feature_spaces"),
},
"feature_state_counters": {
isFeature: true,
Expand Down Expand Up @@ -733,6 +742,7 @@ export const SETTINGS: {[setting: string]: ISetting} = {
[UIFeature.Communities]: {
supportedLevels: LEVELS_UI_FEATURE,
default: true,
controller: new IncompatibleController("feature_spaces"),
},
[UIFeature.AdvancedSettings]: {
supportedLevels: LEVELS_UI_FEATURE,
Expand Down
1 change: 1 addition & 0 deletions src/stores/BreadcrumbsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/stores/room-list/RoomListStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
private filterConditions: IFilterCondition[] = [];
private tagWatcher = new TagWatcher(this);
private updateFn = new MarkedExecution(() => {
for (const tagId of Object.keys(this.unfilteredLists)) {
RoomNotificationStateStore.instance.getListState(tagId).setRooms(this.unfilteredLists[tagId]);
for (const tagId of Object.keys(this.orderedLists)) {
RoomNotificationStateStore.instance.getListState(tagId).setRooms(this.orderedLists[tagId]);
}
this.emit(LISTS_UPDATE_EVENT);
});
Expand Down
18 changes: 10 additions & 8 deletions src/stores/room-list/filters/VisibilityProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
}
}