-
-
Notifications
You must be signed in to change notification settings - Fork 828
Spaces.includeSubSpaceRoomsInRoomList settings #7682
Conversation
… setting in SpaceFilterCondition Signed-off-by: Kerry Archibald <kerrya@element.io>
Signed-off-by: Kerry Archibald <kerrya@element.io>
Signed-off-by: Kerry Archibald <kerrya@element.io>
Signed-off-by: Kerry Archibald <kerrya@element.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation, whilst functional, pushes into the hard-to-maintain. I think this might be a point where refactoring the SpaceFilterCondition and SpaceNotificationState to be hierarchical (contain child instances of themselves for each sub-space) and then only store Maps from spaceId->direct children would be more sane as then simply culling the hierarchical behaviour in SpaceFilterCondition would achieve this setting
src/settings/Settings.tsx
Outdated
@@ -858,6 +858,11 @@ export const SETTINGS: {[setting: string]: ISetting} = { | |||
default: true, | |||
controller: new IncompatibleController("showCommunitiesInsteadOfSpaces", null), | |||
}, | |||
"Spaces.includeSubSpaceRoomsInRoomList": { | |||
displayName: _td("Include all sub-space rooms in Space room list"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We consider sub-space/subspace jargon and do not use it in the UI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What language should be used? is there a guide for this somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1,237 @@ | |||
import { mocked } from 'ts-jest/utils'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copyright
src/stores/spaces/SpaceStore.ts
Outdated
@@ -101,6 +101,8 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> { | |||
private notificationStateMap = new Map<SpaceKey, SpaceNotificationState>(); | |||
// Map from space key to Set of room IDs that should be shown as part of that space's filter | |||
private spaceFilteredRooms = new Map<SpaceKey, Set<string>>(); // won't contain MetaSpace.People | |||
// Map from space key to Set of room IDs that should be shown as part of that space's filter | |||
private spaceFilteredDirectChildRooms = new Map<SpaceKey, Set<string>>(); // won't contain MetaSpace.People |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also presumably does not need to contain the other metaspaces given that'd just be duplicated identical data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not only does not need to contain, simply would not contain, given you only populate it with spaceIds, so the signature needs updating to reflect reality
src/stores/spaces/SpaceStore.ts
Outdated
if (space === MetaSpace.Home && this.allRoomsInHome) { | ||
return this.getSpaceFilteredRoomIds(space); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO all metaspaces should get handled by the non-direct variant given metaspaces can't have child spaces
src/stores/spaces/SpaceStore.ts
Outdated
const expandedRoomIds = new Set(Array.from(roomIds).flatMap(roomId => { | ||
return this.matrixClient.getRoomUpgradeHistory(roomId, true).map(r => r.roomId); | ||
})); | ||
const expandedDirectChildRoomIds = new Set(directChildRoomIds.flatMap(roomId => { | ||
return this.matrixClient.getRoomUpgradeHistory(roomId, true).map(r => r.roomId); | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this duplicates work between the two loops
@t3chguy Is it the amount of state tracked to check for changes in |
The thing that concerns me is the very minute differences between the various fields, which would go away if things were done hierarchically, like how this new field is indirect children except doesn't concern itself with metaspaces, etc. |
How does this interact with notification badges? If you set it to false then will the notifications badge still aggregate counts of grand*-child rooms? If it does continue aggregating then this will be confusing, as you click the space with a Red (8) and find no rooms which match that expectation, then you click the (8) itself and it takes you to a room in a different view (subspace). |
Signed-off-by: Kerry Archibald <kerrya@element.io>
Signed-off-by: Kerry Archibald <kerrya@element.io>
Signed-off-by: Kerry Archibald <kerrya@element.io>
Signed-off-by: Kerry Archibald <kerrya@element.io>
Signed-off-by: Kerry Archibald <kerrya@element.io>
@t3chguy this one is back for more review :-) **Ignore this, need to test notification states |
Sure, the typical approach we take is maintaining and passing around a parentPath Set to prevent hitting upon such a cycle, would be nice if you could stick up what you have into a draft PR so someone else might continue it if you can't :) |
Notification states when sub space rooms are hidden are a bit strange. I don't use any other messaging tools with the level of nesting that Element allows so I'm not sure what behaviour is usual. @nadonomy what do you think? Screen.Recording.2022-02-18.at.12.13.48.movExpanding the space panel is ok, but makes it at least 3 clicks to find your unread room. |
This PR fixes element-hq/element-meta#418 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switchToRelatedSpace
will also need updating to handle the case where the root space has Spaces.includeSubSpaceRoomsInRoomList
set to false
and yet it still will choose it but the room will not be visible in the filtered Room List.
@@ -136,6 +136,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> { | |||
SettingsStore.monitorSetting("Spaces.allRoomsInHome", null); | |||
SettingsStore.monitorSetting("Spaces.enabledMetaSpaces", null); | |||
SettingsStore.monitorSetting("Spaces.showPeopleInSpace", null); | |||
SettingsStore.monitorSetting("Spaces.includeSubSpaceRoomsInRoomList", null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this monitoring a setting which it doesn't react to changes of?
Signed-off-by: Kerry Archibald <kerrya@element.io>
Seems like a really niche feature add! My active subspace rooms flood the space rooms and I can't find them without searching for them... |
Adds a setting to allow only showing direct children of a space in the room list:
Here's what your changelog entry will look like:
✨ Features
Preview: https://pr7682--matrix-react-sdk.netlify.app
⚠️ Do you trust the author of this PR? Maybe this build will steal your keys or give you malware. Exercise caution. Use test accounts.