Only show a Matrix ID in the room picker for a direct message

heroes is populated for any room whose name is derived from its members,
not only for direct messages, so a two person room that is not a DM
showed a member's Matrix ID as its subtitle.

Carry isDm on SelectRoomInfo and read the hero only when it is set. The
canonical alias still takes precedence, so nothing changes for a room
that has one.
This commit is contained in:
hayaksi1
2026-08-10 16:46:58 +03:00
parent acb9e0e082
commit 629dc15a86
6 changed files with 35 additions and 1 deletions
@@ -31,6 +31,7 @@ fun aSelectRoomInfo(
canonicalAlias: RoomAlias? = null,
avatarUrl: String? = null,
heroes: ImmutableList<MatrixUser> = persistentListOf(),
isDm: Boolean = false,
isTombstoned: Boolean = false,
) = SelectRoomInfo(
roomId = roomId,
@@ -38,5 +39,6 @@ fun aSelectRoomInfo(
canonicalAlias = canonicalAlias,
avatarUrl = avatarUrl,
heroes = heroes,
isDm = isDm,
isTombstoned = isTombstoned,
)
@@ -23,6 +23,7 @@ data class SelectRoomInfo(
val canonicalAlias: RoomAlias?,
val avatarUrl: String?,
val heroes: ImmutableList<MatrixUser>,
val isDm: Boolean,
val isTombstoned: Boolean,
) {
fun getAvatarData(size: AvatarSize) = AvatarData(
@@ -41,5 +42,6 @@ fun RoomInfo.toSelectRoomInfo() = SelectRoomInfo(
avatarUrl = avatarUrl,
heroes = heroes,
canonicalAlias = canonicalAlias,
isDm = isDm,
isTombstoned = successorRoom != null,
)