Apply suggestion

This commit is contained in:
Benoit Marty 2022-04-25 17:55:31 +02:00
parent fb736281f0
commit d2eca739f4
1 changed files with 2 additions and 2 deletions

View File

@ -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)),