fix unread logic to take into account subspaces
This commit is contained in:
parent
3310d9b907
commit
309d0df581
1 changed files with 25 additions and 10 deletions
|
|
@ -100,17 +100,32 @@ class Sidebar extends HookConsumerWidget {
|
||||||
destinations: spaces
|
destinations: spaces
|
||||||
.map(
|
.map(
|
||||||
(space) => NavigationRailM3EDestination(
|
(space) => NavigationRailM3EDestination(
|
||||||
badgeCount: switch (space.children.fold(
|
badgeCount: switch (space.children
|
||||||
0,
|
.addAll(
|
||||||
(previousValue, room) =>
|
space.subSpaces
|
||||||
previousValue +
|
.map((element) => element.children)
|
||||||
(room.metadata?.unreadNotifications ?? 0),
|
.flattened,
|
||||||
)) {
|
)
|
||||||
|
.fold(
|
||||||
|
0,
|
||||||
|
(previousValue, room) =>
|
||||||
|
previousValue +
|
||||||
|
(room.metadata?.unreadNotifications ?? 0),
|
||||||
|
)) {
|
||||||
0 =>
|
0 =>
|
||||||
space.children.any(
|
space.children
|
||||||
(room) =>
|
.addAll(
|
||||||
room.metadata?.unreadMessages != 0,
|
space.subSpaces
|
||||||
)
|
.map(
|
||||||
|
(element) => element.children,
|
||||||
|
)
|
||||||
|
.flattened,
|
||||||
|
)
|
||||||
|
.any(
|
||||||
|
(room) =>
|
||||||
|
room.metadata?.unreadMessages !=
|
||||||
|
0,
|
||||||
|
)
|
||||||
? 0
|
? 0
|
||||||
: null,
|
: null,
|
||||||
int badgeCount => badgeCount,
|
int badgeCount => badgeCount,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue