Fixes #2778
This commit is contained in:
parent
d11ed8c4ef
commit
6d5f89b65b
|
@ -8,7 +8,7 @@ Improvements 🙌:
|
||||||
-
|
-
|
||||||
|
|
||||||
Bugfix 🐛:
|
Bugfix 🐛:
|
||||||
-
|
- Join room by alias other federation error (#2778)
|
||||||
|
|
||||||
Translations 🗣:
|
Translations 🗣:
|
||||||
-
|
-
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package org.matrix.android.sdk.internal.session.room.peeking
|
package org.matrix.android.sdk.internal.session.room.peeking
|
||||||
|
|
||||||
import org.matrix.android.sdk.api.MatrixPatterns
|
import org.matrix.android.sdk.api.MatrixPatterns
|
||||||
|
import org.matrix.android.sdk.api.extensions.tryOrNull
|
||||||
import org.matrix.android.sdk.api.session.events.model.EventType
|
import org.matrix.android.sdk.api.session.events.model.EventType
|
||||||
import org.matrix.android.sdk.api.session.events.model.toModel
|
import org.matrix.android.sdk.api.session.events.model.toModel
|
||||||
import org.matrix.android.sdk.api.session.room.model.RoomAvatarContent
|
import org.matrix.android.sdk.api.session.room.model.RoomAvatarContent
|
||||||
|
@ -65,23 +66,29 @@ internal class DefaultPeekRoomTask @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is it a public room?
|
// Is it a public room?
|
||||||
val publicRepoResult = when (getRoomDirectoryVisibilityTask.execute(GetRoomDirectoryVisibilityTask.Params(roomId))) {
|
val visibilityRes = tryOrNull("## PEEK: failed to get visibility") {
|
||||||
RoomDirectoryVisibility.PRIVATE -> {
|
getRoomDirectoryVisibilityTask.execute(GetRoomDirectoryVisibilityTask.Params(roomId))
|
||||||
// We cannot resolve this room :/
|
}
|
||||||
null
|
val publicRepoResult = when (visibilityRes) {
|
||||||
}
|
RoomDirectoryVisibility.PUBLIC -> {
|
||||||
RoomDirectoryVisibility.PUBLIC -> {
|
|
||||||
// Try to find it in directory
|
// Try to find it in directory
|
||||||
val filter = if (isAlias) PublicRoomsFilter(searchTerm = params.roomIdOrAlias.substring(1))
|
val filter = if (isAlias) PublicRoomsFilter(searchTerm = params.roomIdOrAlias.substring(1))
|
||||||
else null
|
else null
|
||||||
|
|
||||||
getPublicRoomTask.execute(GetPublicRoomTask.Params(
|
tryOrNull("## PEEK: failed to GetPublicRoomTask") {
|
||||||
server = serverList.firstOrNull(),
|
getPublicRoomTask.execute(GetPublicRoomTask.Params(
|
||||||
publicRoomsParams = PublicRoomsParams(
|
server = serverList.firstOrNull(),
|
||||||
filter = filter,
|
publicRoomsParams = PublicRoomsParams(
|
||||||
limit = 20.takeIf { filter != null } ?: 100
|
filter = filter,
|
||||||
)
|
limit = 20.takeIf { filter != null } ?: 100
|
||||||
)).chunk?.firstOrNull { it.roomId == roomId }
|
)
|
||||||
|
))
|
||||||
|
}?.chunk?.firstOrNull { it.roomId == roomId }
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
// RoomDirectoryVisibility.PRIVATE or null
|
||||||
|
// We cannot resolve this room :/
|
||||||
|
null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue