Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Spaces.includeSubSpaceRoomsInRoomList settings #7682

Closed
wants to merge 18 commits into from

Conversation

kerryarchibald
Copy link
Contributor

@kerryarchibald kerryarchibald commented Jan 31, 2022

Adds a setting to allow only showing direct children of a space in the room list:
Screenshot 2022-01-31 at 17 37 58
Screenshot 2022-01-31 at 17 38 39
Screenshot 2022-01-31 at 17 38 54


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.

Kerry Archibald added 5 commits January 31, 2022 17:26
… 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>
@kerryarchibald kerryarchibald added the T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements label Jan 31, 2022
@kerryarchibald kerryarchibald requested a review from a team as a code owner January 31, 2022 16:43
Signed-off-by: Kerry Archibald <kerrya@element.io>
Copy link
Member

@t3chguy t3chguy left a 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

@@ -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"),
Copy link
Member

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

Copy link
Contributor Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no guide given that Subspaces are still in Beta.

image

There is no existing language here but all instances of "sub-space" were previously stripped from the app so should not be re-introduced without being done holistically and intentionally.

@@ -0,0 +1,237 @@
import { mocked } from 'ts-jest/utils';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copyright

@@ -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
Copy link
Member

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

Copy link
Member

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

Comment on lines 397 to 399
if (space === MetaSpace.Home && this.allRoomsInHome) {
return this.getSpaceFilteredRoomIds(space);
}
Copy link
Member

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

Comment on lines 733 to 738
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);
}));
Copy link
Member

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

@kerryarchibald
Copy link
Contributor Author

@t3chguy Is it the amount of state tracked to check for changes in onStoreUpdate that concerns you?
Adding hierarchical space filters seems like adding quite a lot of complexity for a relatively small win. Maintenance of both direct and indirect child lists in SpaceStore is still needed as isRoomInSpace depends on the indirect child list and is used pretty widely. It also complexifies the application of space settings - should the active spaces settings be applied down the hierarchy?

@t3chguy
Copy link
Member

t3chguy commented Feb 2, 2022

@t3chguy Is it the amount of state tracked to check for changes in onStoreUpdate that concerns you? Adding hierarchical space filters seems like adding quite a lot of complexity for a relatively small win. Maintenance of both direct and indirect child lists in SpaceStore is still needed as isRoomInSpace depends on the indirect child list and is used pretty widely. It also complexifies the application of space settings - should the active spaces settings be applied down the hierarchy?

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.

@kerryarchibald kerryarchibald marked this pull request as draft February 4, 2022 15:56
@t3chguy
Copy link
Member

t3chguy commented Feb 4, 2022

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).
If it doesn't then you may miss notifications due to the subspace not being visible with the panel collapsed, so this may require some finesse.

Kerry Archibald added 6 commits February 18, 2022 10:33
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>
@kerryarchibald kerryarchibald marked this pull request as ready for review February 18, 2022 10:58
@kerryarchibald
Copy link
Contributor Author

kerryarchibald commented Feb 18, 2022

@t3chguy this one is back for more review :-)
Hierarchical space filters hit a major snag on cycles being allowed in space hierarchy. Shelving that for now to get this feature over the line.

**Ignore this, need to test notification states

@kerryarchibald kerryarchibald marked this pull request as draft February 18, 2022 11:01
@t3chguy
Copy link
Member

t3chguy commented Feb 18, 2022

Hierarchical space filters hit a major snag on cycles being allowed in space hierarchy. Shelving that for now to get this feature over the line.

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 :)

@kerryarchibald
Copy link
Contributor Author

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.mov

Expanding the space panel is ok, but makes it at least 3 clicks to find your unread room.
Screenshot 2022-02-18 at 12 08 24
Screenshot 2022-02-18 at 12 08 32

Compared to probably 2 clicks in the current room list:
Screenshot 2022-02-18 at 12 24 54

@t3chguy
Copy link
Member

t3chguy commented Feb 18, 2022

This PR fixes element-hq/element-meta#418

@kerryarchibald kerryarchibald requested review from nadonomy and a team and removed request for nadonomy February 21, 2022 16:50
Copy link
Member

@t3chguy t3chguy left a 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);
Copy link
Member

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>
@QuditWolf
Copy link

Seems like a really niche feature add!
What are the odds that this still gets merged?

My active subspace rooms flood the space rooms and I can't find them without searching for them...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants