Changes string format of space parents to maintain parity with web

This commit is contained in:
ericdecanini 2022-07-06 13:36:17 +01:00
parent 98d195c010
commit c6728dde38
2 changed files with 12 additions and 1 deletions

View file

@ -207,9 +207,18 @@ class RoomSummaryItemFactory @Inject constructor(
private fun getSearchResultSubtitle(roomSummary: RoomSummary): String {
val userId = roomSummary.directUserId
val directParent = roomSummary.directParentNames.takeIf { it.isNotEmpty() }?.joinToString()
val directParent = joinParentNames(roomSummary)
val canonicalAlias = roomSummary.canonicalAlias
return (userId ?: directParent ?: canonicalAlias).orEmpty()
}
private fun joinParentNames(roomSummary: RoomSummary) = with(roomSummary) {
when (directParentNames.size) {
0 -> null
1 -> directParentNames.first()
2 -> stringProvider.getString(R.string.search_space_two_parents, directParentNames[0], directParentNames[1])
else -> stringProvider.getString(R.string.search_space_multiple_parents, directParentNames.first(), directParentNames.size - 1)
}
}
}

View file

@ -762,6 +762,8 @@
<string name="search_members_hint">Filter room members</string>
<string name="search_banned_user_hint">Filter banned users</string>
<string name="search_no_results">No results</string>
<string name="search_space_two_parents">%1$s and %2$s</string>
<string name="search_space_multiple_parents">%1$s and %2$d others</string>
<!-- home room settings -->
<string name="room_settings_all_messages">All messages</string>