mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 01:45:05 +08:00
Changes directParentName to a list
This commit is contained in:
parent
cb400b660d
commit
ed3a201f0b
@ -164,9 +164,9 @@ data class RoomSummary(
|
||||
*/
|
||||
val spaceChildren: List<SpaceChildInfo>? = null,
|
||||
/**
|
||||
* The name of the room's direct space parent if any.
|
||||
* The names of the room's direct space parents if any.
|
||||
*/
|
||||
val directParentName: String? = null,
|
||||
val directParentNames: List<String> = emptyList(),
|
||||
/**
|
||||
* List of all the space parent Ids.
|
||||
*/
|
||||
|
@ -106,7 +106,7 @@ internal class RoomSummaryMapper @Inject constructor(
|
||||
worldReadable = it.childSummaryEntity?.joinRules == RoomJoinRules.PUBLIC
|
||||
)
|
||||
},
|
||||
directParentName = roomSummaryEntity.directParentName,
|
||||
directParentNames = roomSummaryEntity.directParentNames.toList(),
|
||||
flattenParentIds = roomSummaryEntity.flattenParentIds?.split("|") ?: emptyList(),
|
||||
roomEncryptionAlgorithm = when (val alg = roomSummaryEntity.e2eAlgorithm) {
|
||||
// I should probably use #hasEncryptorClassForAlgorithm but it says it supports
|
||||
|
@ -235,10 +235,7 @@ internal open class RoomSummaryEntity(
|
||||
if (value != field) field = value
|
||||
}
|
||||
|
||||
var directParentName: String? = null
|
||||
set(value) {
|
||||
if (value != field) field = value
|
||||
}
|
||||
var directParentNames: RealmList<String> = RealmList()
|
||||
|
||||
var flattenParentIds: String? = null
|
||||
set(value) {
|
||||
|
@ -351,15 +351,9 @@ 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 }
|
||||
@ -370,7 +364,7 @@ internal class RoomSummaryUpdater @Inject constructor(
|
||||
|
||||
entry.value.forEach { child ->
|
||||
RoomSummaryEntity.where(realm, child.roomId).findFirst()?.let { childSum ->
|
||||
childSum.directParentName = parent.displayName()
|
||||
childSum.directParentNames.add(parent.displayName())
|
||||
|
||||
if (childSum.flattenParentIds == null) {
|
||||
childSum.flattenParentIds = ""
|
||||
|
@ -207,7 +207,7 @@ class RoomSummaryItemFactory @Inject constructor(
|
||||
|
||||
private fun getSearchResultSubtitle(roomSummary: RoomSummary): String {
|
||||
val userId = roomSummary.directUserId
|
||||
val directParent = roomSummary.directParentName
|
||||
val directParent = roomSummary.directParentNames.lastOrNull()
|
||||
val canonicalAlias = roomSummary.canonicalAlias
|
||||
|
||||
return (userId ?: directParent ?: canonicalAlias).orEmpty()
|
||||
|
Loading…
Reference in New Issue
Block a user