Merge branch 'develop' into feature/bma/widget_url_robustness

This commit is contained in:
Benoit Marty 2021-02-06 11:19:15 +01:00 committed by GitHub
commit d903dfb40b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 14 deletions

View File

@ -9,6 +9,8 @@ Improvements 🙌:
Bugfix 🐛:
- Bug in WidgetContent.computeURL() (#2767)
- Duplicate thumbs | Mobile reactions for 👍 and 👎 are not the same as web (#2776)
- Join room by alias other federation error (#2778)
Translations 🗣:
-

View File

@ -17,6 +17,7 @@
package org.matrix.android.sdk.internal.session.room.peeking
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.toModel
import org.matrix.android.sdk.api.session.room.model.RoomAvatarContent
@ -65,23 +66,29 @@ internal class DefaultPeekRoomTask @Inject constructor(
}
// Is it a public room?
val publicRepoResult = when (getRoomDirectoryVisibilityTask.execute(GetRoomDirectoryVisibilityTask.Params(roomId))) {
RoomDirectoryVisibility.PRIVATE -> {
// We cannot resolve this room :/
null
val visibilityRes = tryOrNull("## PEEK: failed to get visibility") {
getRoomDirectoryVisibilityTask.execute(GetRoomDirectoryVisibilityTask.Params(roomId))
}
val publicRepoResult = when (visibilityRes) {
RoomDirectoryVisibility.PUBLIC -> {
// Try to find it in directory
val filter = if (isAlias) PublicRoomsFilter(searchTerm = params.roomIdOrAlias.substring(1))
else null
tryOrNull("## PEEK: failed to GetPublicRoomTask") {
getPublicRoomTask.execute(GetPublicRoomTask.Params(
server = serverList.firstOrNull(),
publicRoomsParams = PublicRoomsParams(
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
}
}

View File

@ -95,6 +95,6 @@ class EmojiDataSource @Inject constructor(
}
companion object {
val quickEmojis = listOf("👍", "👎", "😄", "🎉", "😕", "❤️", "🚀", "👀")
val quickEmojis = listOf("\uD83D\uDC4D", "\uD83D\uDC4E", "😄", "🎉", "😕", "❤️", "🚀", "👀")
}
}