mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-29 14:38:45 +03:00
Fixes upgraded room duplication
This commit is contained in:
parent
b0ce32e97e
commit
af4f8d001e
2 changed files with 5 additions and 2 deletions
|
@ -84,8 +84,6 @@ class UpgradeRoomViewModelTask @Inject constructor(
|
|||
// autoJoin = currentInfo.autoJoin ?: false,
|
||||
suggested = currentInfo.suggested
|
||||
)
|
||||
|
||||
parentSpace.removeChildren(params.roomId)
|
||||
}
|
||||
}
|
||||
} catch (failure: Throwable) {
|
||||
|
|
|
@ -44,6 +44,7 @@ import org.matrix.android.sdk.api.failure.MatrixError.Companion.M_UNRECOGNIZED
|
|||
import org.matrix.android.sdk.api.session.room.members.ChangeMembershipState
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomType
|
||||
import org.matrix.android.sdk.api.session.room.model.SpaceChildInfo
|
||||
import org.matrix.android.sdk.api.session.room.model.VersioningState
|
||||
import org.matrix.android.sdk.api.util.toMatrixItem
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -110,6 +111,7 @@ class SpaceDirectoryController @Inject constructor(
|
|||
?.filter {
|
||||
it.parentRoomId == (data.hierarchyStack.lastOrNull() ?: data.spaceId)
|
||||
}
|
||||
?.filterNot { it.isUpgradedRoom(data) }
|
||||
?: emptyList()
|
||||
|
||||
if (flattenChildInfo.isEmpty()) {
|
||||
|
@ -209,4 +211,7 @@ class SpaceDirectoryController @Inject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun SpaceChildInfo.isUpgradedRoom(data: SpaceDirectoryState) =
|
||||
data.knownRoomSummaries.any { it.roomId == childRoomId && it.versioningState == VersioningState.UPGRADED_ROOM_JOINED }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue