Apply suggestion
This commit is contained in:
parent
fb736281f0
commit
d2eca739f4
|
@ -297,12 +297,12 @@ class SpaceListViewModel @AssistedInject constructor(@Assisted initialState: Spa
|
||||||
}
|
}
|
||||||
.execute { async ->
|
.execute { async ->
|
||||||
val rootSpaces = async.invoke().orEmpty().filter { it.flattenParentIds.isEmpty() }
|
val rootSpaces = async.invoke().orEmpty().filter { it.flattenParentIds.isEmpty() }
|
||||||
val orders = rootSpaces.map {
|
val orders = rootSpaces.associate {
|
||||||
it.roomId to session.getRoom(it.roomId)
|
it.roomId to session.getRoom(it.roomId)
|
||||||
?.getAccountDataEvent(RoomAccountDataTypes.EVENT_TYPE_SPACE_ORDER)
|
?.getAccountDataEvent(RoomAccountDataTypes.EVENT_TYPE_SPACE_ORDER)
|
||||||
?.content.toModel<SpaceOrderContent>()
|
?.content.toModel<SpaceOrderContent>()
|
||||||
?.safeOrder()
|
?.safeOrder()
|
||||||
}.toMap()
|
}
|
||||||
copy(
|
copy(
|
||||||
asyncSpaces = async,
|
asyncSpaces = async,
|
||||||
rootSpacesOrdered = rootSpaces.sortedWith(TopLevelSpaceComparator(orders)),
|
rootSpacesOrdered = rootSpaces.sortedWith(TopLevelSpaceComparator(orders)),
|
||||||
|
|
Loading…
Reference in New Issue