From 080b6bef7eae431238f68ba311f46368a425c611 Mon Sep 17 00:00:00 2001 From: ggurdin <46800240+ggurdin@users.noreply.github.com> Date: Thu, 5 Dec 2024 16:31:45 -0500 Subject: [PATCH] more accurate chat count in space view (#1164) --- lib/pages/chat_list/space_view.dart | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/pages/chat_list/space_view.dart b/lib/pages/chat_list/space_view.dart index 61509dcf0..8385520e4 100644 --- a/lib/pages/chat_list/space_view.dart +++ b/lib/pages/chat_list/space_view.dart @@ -521,6 +521,19 @@ class _SpaceViewState extends State { } return 0; } + + List? get joinedRooms { + final room = Matrix.of(context).client.getRoomById(widget.spaceId); + if (room == null) return null; + + final spaceChildIds = + room.spaceChildren.map((c) => c.roomId).whereType().toSet(); + + return room.client.rooms + .where((room) => spaceChildIds.contains(room.id)) + .where((room) => !room.isAnalyticsRoom) + .toList(); + } // Pangea# @override @@ -554,7 +567,11 @@ class _SpaceViewState extends State { ? null : Text( L10n.of(context)!.countChatsAndCountParticipants( - room.spaceChildren.length, + // #Pangea + // room.spaceChildren.length, + (_discoveredChildren?.length ?? 0) + + (joinedRooms?.length ?? 0), + // Pangea# room.summary.mJoinedMemberCount ?? 1, ), maxLines: 1,