Use awaitRoomSummary
This commit is contained in:
parent
ebd491c6f0
commit
2acfce2d20
@ -51,7 +51,7 @@ internal class DefaultLeaveRoomTask @Inject constructor(
|
||||
}
|
||||
|
||||
private suspend fun leaveRoom(roomId: String, reason: String?) {
|
||||
val roomSummary = roomSummaryDataSource.getRoomSummary(roomId)
|
||||
val roomSummary = roomSummaryDataSource.awaitRoomSummary(roomId)
|
||||
if (roomSummary?.membership?.isActive() == false) {
|
||||
Timber.v("Room $roomId is not joined so can't be left")
|
||||
return
|
||||
|
@ -53,7 +53,7 @@ internal class DefaultSpace(
|
||||
) {
|
||||
// Find best via
|
||||
val bestVia = viaServers
|
||||
?: (spaceSummaryDataSource.getRoomSummary(roomId)
|
||||
?: (spaceSummaryDataSource.awaitRoomSummary(roomId)
|
||||
?.takeIf { it.joinRules == RoomJoinRules.RESTRICTED }
|
||||
?.let {
|
||||
// for restricted room, best to take via from users that can invite in the
|
||||
|
@ -246,7 +246,7 @@ internal class DefaultSpaceService @Inject constructor(
|
||||
// and if client want to bypass, it could use sendStateEvent directly?
|
||||
if (canonical) {
|
||||
// check that we can send m.child in the parent room
|
||||
if (roomSummaryDataSource.getRoomSummary(parentSpaceId)?.membership != Membership.JOIN) {
|
||||
if (roomSummaryDataSource.awaitRoomSummary(parentSpaceId)?.membership != Membership.JOIN) {
|
||||
throw UnsupportedOperationException("Cannot add canonical child if not member of parent")
|
||||
}
|
||||
val powerLevelsEvent = stateEventDataSource.getStateEvent(
|
||||
|
@ -58,7 +58,7 @@ class CallUserMapper(private val session: Session, private val protocolsChecker:
|
||||
protocolsChecker.awaitCheckProtocols()
|
||||
if (!protocolsChecker.supportVirtualRooms) return
|
||||
val invitedRoom = session.getRoom(invitedRoomId) ?: return
|
||||
val inviterId = invitedRoom.roomSummary()?.inviterId ?: return
|
||||
val inviterId = invitedRoom.awaitRoomSummary()?.inviterId ?: return
|
||||
val nativeLookup = session.sipNativeLookup(inviterId).firstOrNull() ?: return
|
||||
if (nativeLookup.fields.containsKey("is_virtual")) {
|
||||
val nativeUser = nativeLookup.userId
|
||||
|
@ -294,7 +294,7 @@ class RoomListViewModel @AssistedInject constructor(
|
||||
session.getRoom(action.roomId)?.let { room ->
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
try {
|
||||
if (room.roomSummary()?.hasTag(action.tag) == false) {
|
||||
if (room.awaitRoomSummary()?.hasTag(action.tag) == false) {
|
||||
// Favorite and low priority tags are exclusive, so maybe delete the other tag first
|
||||
action.tag.otherTag()
|
||||
?.takeIf { room.roomSummary()?.hasTag(it).orFalse() }
|
||||
|
@ -122,7 +122,7 @@ class InvitesAcceptor @Inject constructor(
|
||||
// if we got 404 on invites, the inviting user have left or the hs is off.
|
||||
if (failure is Failure.ServerError && failure.httpCode == 404) {
|
||||
val room = getRoom(roomId) ?: return
|
||||
val inviterId = room.roomSummary()?.inviterId
|
||||
val inviterId = room.awaitRoomSummary()?.inviterId
|
||||
// if the inviting user is on the same HS, there can only be one cause: they left, so we try to reject the invite.
|
||||
if (inviterId?.endsWith(sessionParams.credentials.homeServer.orEmpty()).orFalse()) {
|
||||
shouldRejectRoomIds.add(roomId)
|
||||
|
Loading…
Reference in New Issue
Block a user