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,
|
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.
|
* List of all the space parent Ids.
|
||||||
*/
|
*/
|
||||||
|
@ -106,7 +106,7 @@ internal class RoomSummaryMapper @Inject constructor(
|
|||||||
worldReadable = it.childSummaryEntity?.joinRules == RoomJoinRules.PUBLIC
|
worldReadable = it.childSummaryEntity?.joinRules == RoomJoinRules.PUBLIC
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
directParentName = roomSummaryEntity.directParentName,
|
directParentNames = roomSummaryEntity.directParentNames.toList(),
|
||||||
flattenParentIds = roomSummaryEntity.flattenParentIds?.split("|") ?: emptyList(),
|
flattenParentIds = roomSummaryEntity.flattenParentIds?.split("|") ?: emptyList(),
|
||||||
roomEncryptionAlgorithm = when (val alg = roomSummaryEntity.e2eAlgorithm) {
|
roomEncryptionAlgorithm = when (val alg = roomSummaryEntity.e2eAlgorithm) {
|
||||||
// I should probably use #hasEncryptorClassForAlgorithm but it says it supports
|
// I should probably use #hasEncryptorClassForAlgorithm but it says it supports
|
||||||
|
@ -235,10 +235,7 @@ internal open class RoomSummaryEntity(
|
|||||||
if (value != field) field = value
|
if (value != field) field = value
|
||||||
}
|
}
|
||||||
|
|
||||||
var directParentName: String? = null
|
var directParentNames: RealmList<String> = RealmList()
|
||||||
set(value) {
|
|
||||||
if (value != field) field = value
|
|
||||||
}
|
|
||||||
|
|
||||||
var flattenParentIds: String? = null
|
var flattenParentIds: String? = null
|
||||||
set(value) {
|
set(value) {
|
||||||
|
@ -351,15 +351,9 @@ internal class RoomSummaryUpdater @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val acyclicGraph = graph.withoutEdges(backEdges)
|
val acyclicGraph = graph.withoutEdges(backEdges)
|
||||||
// Timber.v("## SPACES: acyclicGraph $acyclicGraph")
|
|
||||||
val flattenSpaceParents = acyclicGraph.flattenDestination().map {
|
val flattenSpaceParents = acyclicGraph.flattenDestination().map {
|
||||||
it.key.name to it.value.map { it.name }
|
it.key.name to it.value.map { it.name }
|
||||||
}.toMap()
|
}.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
|
lookupMap.entries
|
||||||
.filter { it.key.roomType == RoomType.SPACE && it.key.membership == Membership.JOIN }
|
.filter { it.key.roomType == RoomType.SPACE && it.key.membership == Membership.JOIN }
|
||||||
@ -370,7 +364,7 @@ internal class RoomSummaryUpdater @Inject constructor(
|
|||||||
|
|
||||||
entry.value.forEach { child ->
|
entry.value.forEach { child ->
|
||||||
RoomSummaryEntity.where(realm, child.roomId).findFirst()?.let { childSum ->
|
RoomSummaryEntity.where(realm, child.roomId).findFirst()?.let { childSum ->
|
||||||
childSum.directParentName = parent.displayName()
|
childSum.directParentNames.add(parent.displayName())
|
||||||
|
|
||||||
if (childSum.flattenParentIds == null) {
|
if (childSum.flattenParentIds == null) {
|
||||||
childSum.flattenParentIds = ""
|
childSum.flattenParentIds = ""
|
||||||
|
@ -207,7 +207,7 @@ class RoomSummaryItemFactory @Inject constructor(
|
|||||||
|
|
||||||
private fun getSearchResultSubtitle(roomSummary: RoomSummary): String {
|
private fun getSearchResultSubtitle(roomSummary: RoomSummary): String {
|
||||||
val userId = roomSummary.directUserId
|
val userId = roomSummary.directUserId
|
||||||
val directParent = roomSummary.directParentName
|
val directParent = roomSummary.directParentNames.lastOrNull()
|
||||||
val canonicalAlias = roomSummary.canonicalAlias
|
val canonicalAlias = roomSummary.canonicalAlias
|
||||||
|
|
||||||
return (userId ?: directParent ?: canonicalAlias).orEmpty()
|
return (userId ?: directParent ?: canonicalAlias).orEmpty()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user