Fix request too large Uri error when joining a room

This commit is contained in:
Benoit Marty 2021-01-12 18:16:35 +01:00
parent 5431584b3c
commit 7446b12827
3 changed files with 20 additions and 3 deletions

View File

@ -18,6 +18,7 @@ Bugfix 🐛:
- Tapping drawer having more than 1 room in notifications gives "malformed link" error (#2605)
- Sent image not displayed when opened immediately after sending (#409)
- Initial sync is not retried correctly when there is some network error. (#2632)
- Fix request too large Uri error when joining a room
Translations 🗣:
-

View File

@ -55,7 +55,11 @@ internal class DefaultJoinRoomTask @Inject constructor(
roomChangeMembershipStateDataSource.updateState(params.roomIdOrAlias, ChangeMembershipState.Joining)
val joinRoomResponse = try {
executeRequest<JoinRoomResponse>(globalErrorReceiver) {
apiCall = roomAPI.join(params.roomIdOrAlias, params.viaServers, mapOf("reason" to params.reason))
apiCall = roomAPI.join(
roomIdOrAlias = params.roomIdOrAlias,
viaServers = params.viaServers.take(3),
params = mapOf("reason" to params.reason)
)
}
} catch (failure: Throwable) {
roomChangeMembershipStateDataSource.updateState(params.roomIdOrAlias, ChangeMembershipState.FailedJoining(failure))

View File

@ -84,22 +84,34 @@ class RoomPreviewViewModel @AssistedInject constructor(@Assisted private val ini
when (peekResult) {
is PeekResult.Success -> {
setState {
// Do not override what we had from the permalink
val newHomeServers = if (homeServers.isEmpty()) {
peekResult.viaServers.take(3)
} else {
homeServers
}
copy(
roomId = peekResult.roomId,
avatarUrl = peekResult.avatarUrl,
roomAlias = peekResult.alias ?: initialState.roomAlias,
roomTopic = peekResult.topic,
homeServers = peekResult.viaServers,
homeServers = newHomeServers,
peekingState = Success(PeekingState.FOUND)
)
}
}
is PeekResult.PeekingNotAllowed -> {
setState {
// Do not override what we had from the permalink
val newHomeServers = if (homeServers.isEmpty()) {
peekResult.viaServers.take(3)
} else {
homeServers
}
copy(
roomId = peekResult.roomId,
roomAlias = peekResult.alias ?: initialState.roomAlias,
homeServers = peekResult.viaServers,
homeServers = newHomeServers,
peekingState = Success(PeekingState.NO_ACCESS)
)
}