Skip to content

Commit 2678834

Browse files
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 <[email protected]>
1 parent 9c64bdd commit 2678834

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/room/MatrixRoomMembers.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ fun MatrixRoom.getDirectRoomMember(roomMembersState: MatrixRoomMembersState): St
5858
return remember(roomMembersState) {
5959
derivedStateOf {
6060
roomMembers
61+
?.filter { it.membership.isActive() }
6162
?.takeIf { it.size == 2 && isDirect && isEncrypted }
6263
?.find { it.userId != sessionId }
6364
}

0 commit comments

Comments
 (0)