mirror of
https://github.com/element-hq/element-android
synced 2024-12-22 01:04:56 +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,
|
// autoJoin = currentInfo.autoJoin ?: false,
|
||||||
suggested = currentInfo.suggested
|
suggested = currentInfo.suggested
|
||||||
)
|
)
|
||||||
|
|
||||||
parentSpace.removeChildren(params.roomId)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (failure: Throwable) {
|
} 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.members.ChangeMembershipState
|
||||||
import org.matrix.android.sdk.api.session.room.model.RoomType
|
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.SpaceChildInfo
|
||||||
|
import org.matrix.android.sdk.api.session.room.model.VersioningState
|
||||||
import org.matrix.android.sdk.api.util.toMatrixItem
|
import org.matrix.android.sdk.api.util.toMatrixItem
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -110,6 +111,7 @@ class SpaceDirectoryController @Inject constructor(
|
||||||
?.filter {
|
?.filter {
|
||||||
it.parentRoomId == (data.hierarchyStack.lastOrNull() ?: data.spaceId)
|
it.parentRoomId == (data.hierarchyStack.lastOrNull() ?: data.spaceId)
|
||||||
}
|
}
|
||||||
|
?.filterNot { it.isUpgradedRoom(data) }
|
||||||
?: emptyList()
|
?: emptyList()
|
||||||
|
|
||||||
if (flattenChildInfo.isEmpty()) {
|
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