Changes ordering of room subtitles used
This commit is contained in:
parent
47493fcfa1
commit
c9b32fec44
|
@ -349,27 +349,39 @@ internal class RoomSummaryUpdater @Inject constructor(
|
|||
}
|
||||
|
||||
val acyclicGraph = graph.withoutEdges(backEdges)
|
||||
// Timber.v("## SPACES: acyclicGraph $acyclicGraph")
|
||||
val flattenSpaceParents = acyclicGraph.flattenDestination().map {
|
||||
it.key.name to it.value.map { it.name }
|
||||
}.toMap()
|
||||
// Timber.v("## SPACES: flattenSpaceParents ${flattenSpaceParents.map { it.key.name to it.value.map { it.name } }.joinToString("\n") {
|
||||
// it.first + ": [" + it.second.joinToString(",") + "]"
|
||||
// }}")
|
||||
|
||||
// Timber.v("## SPACES: lookup map ${lookupMap.map { it.key.name to it.value.map { it.name } }.toMap()}")
|
||||
|
||||
lookupMap.entries
|
||||
.filter { it.key.roomType == RoomType.SPACE && it.key.membership == Membership.JOIN }
|
||||
.forEach { entry ->
|
||||
val parent = RoomSummaryEntity.where(realm, entry.key.roomId).findFirst()
|
||||
if (parent != null) {
|
||||
// Timber.v("## SPACES: check hierarchy of ${parent.name} id ${parent.roomId}")
|
||||
// Timber.v("## SPACES: flat known parents of ${parent.name} are ${flattenSpaceParents[parent.roomId]}")
|
||||
val flattenParentsIds = (flattenSpaceParents[parent.roomId] ?: emptyList()) + listOf(parent.roomId)
|
||||
// Timber.v("## SPACES: flatten known parents of children of ${parent.name} are ${flattenParentsIds}")
|
||||
entry.value.forEach { child ->
|
||||
RoomSummaryEntity.where(realm, child.roomId).findFirst()?.let { childSum ->
|
||||
|
||||
// Timber.w("## SPACES: ${childSum.name} is ${childSum.roomId} fc: ${childSum.flattenParentIds}")
|
||||
// var allParents = childSum.flattenParentIds ?: ""
|
||||
if (childSum.flattenParentIds == null) childSum.flattenParentIds = ""
|
||||
flattenParentsIds.forEach {
|
||||
if (childSum.flattenParentIds?.contains(it) != true) {
|
||||
if (childSum.flattenParentIds?.isEmpty() == false) {
|
||||
childSum.flattenParentIds += "|"
|
||||
}
|
||||
childSum.flattenParentIds += it
|
||||
childSum.flattenParentIds += "|$it"
|
||||
}
|
||||
}
|
||||
// childSum.flattenParentIds = "$allParents|"
|
||||
|
||||
// Timber.v("## SPACES: flatten of ${childSum.name} is ${childSum.flattenParentIds}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -399,6 +411,7 @@ internal class RoomSummaryUpdater @Inject constructor(
|
|||
// we keep real m.child/m.parent relations and add the one for common memberships
|
||||
dmRoom.flattenParentIds += "|${flattenRelated.joinToString("|")}|"
|
||||
}
|
||||
// Timber.v("## SPACES: flatten of ${dmRoom.otherMemberIds.joinToString(",")} is ${dmRoom.flattenParentIds}")
|
||||
}
|
||||
|
||||
// Maybe a good place to count the number of notifications for spaces?
|
||||
|
|
|
@ -153,10 +153,10 @@ class RoomSummaryItemFactory @Inject constructor(private val displayableEventFor
|
|||
}
|
||||
|
||||
private fun getSearchResultSubtitle(roomSummary: RoomSummary): String {
|
||||
val spaceName = roomSummary.spaceParents?.firstOrNull()?.roomSummary?.name
|
||||
val userId = roomSummary.directUserId
|
||||
val spaceName = roomSummary.spaceParents?.firstOrNull()?.roomSummary?.name
|
||||
val canonicalAlias = roomSummary.canonicalAlias
|
||||
|
||||
return (spaceName ?: userId ?: canonicalAlias).orEmpty()
|
||||
return (userId ?: spaceName ?: canonicalAlias).orEmpty()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue