From 12648c42dea58cb81322d4053353a3a03bd508fc Mon Sep 17 00:00:00 2001 From: networkException Date: Thu, 22 Aug 2024 14:47:13 +0200 Subject: [PATCH] Fix broken direct room member for rooms with old users that left (#3324) This patch fixes getDirectRoomMember not respecting direct rooms with more than two members total but only two active. This commonly occurs when users migrate to a new account by adding a new account to rooms and leaving with the old one. Other parts of the codebase (such as the people room list filter) already respect the active member count of a room instead of the total (historic) number of unique members. This fixes the room details screen not showing up correctly, for example missing the avatar cluster. Signed-off-by: networkException --- .../android/libraries/matrix/ui/room/MatrixRoomMembers.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/room/MatrixRoomMembers.kt b/libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/room/MatrixRoomMembers.kt index 38fed2a60c..c04406228f 100644 --- a/libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/room/MatrixRoomMembers.kt +++ b/libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/room/MatrixRoomMembers.kt @@ -58,6 +58,7 @@ fun MatrixRoom.getDirectRoomMember(roomMembersState: MatrixRoomMembersState): St return remember(roomMembersState) { derivedStateOf { roomMembers + ?.filter { it.membership.isActive() } ?.takeIf { it.size == 2 && isDirect && isEncrypted } ?.find { it.userId != sessionId } }