Merge pull request #5668 from matrix-org/t3chguy/spaces2
Initial Spaces feature flagpull/21833/head
						commit
						0f0e6c335f
					
				|  | @ -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) { | ||||
|  |  | |||
|  | @ -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. Requires compatible homeserver for some features.": "Spaces prototype. Incompatible with Communities, Communities v2 and Custom Tags. Requires compatible homeserver for some features.", | ||||
|     "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", | ||||
|  |  | |||
|  | @ -120,6 +120,14 @@ 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. " + | ||||
|             "Requires compatible homeserver for some features."), | ||||
|         supportedLevels: LEVELS_FEATURE, | ||||
|         default: false, | ||||
|         controller: new ReloadOnChangeController(), | ||||
|     }, | ||||
|     "feature_latex_maths": { | ||||
|         isFeature: true, | ||||
|         displayName: _td("Render LaTeX maths in messages"), | ||||
|  | @ -134,6 +142,7 @@ export const SETTINGS: {[setting: string]: ISetting} = { | |||
|         ), | ||||
|         supportedLevels: LEVELS_FEATURE, | ||||
|         default: false, | ||||
|         controller: new IncompatibleController("feature_spaces"), | ||||
|     }, | ||||
|     "feature_new_spinner": { | ||||
|         isFeature: true, | ||||
|  | @ -159,6 +168,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, | ||||
|  | @ -733,6 +743,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, | ||||
|  |  | |||
|  | @ -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
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -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); | ||||
|     }); | ||||
|  |  | |||
|  | @ -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
 | ||||
|     } | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Michael Telatynski
						Michael Telatynski