mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 09:25:49 +03:00
Merge pull request #2661 from vector-im/feature/bma/fix_join
Fix request too large Uri error when joining a room
This commit is contained in:
commit
1d449c84fe
3 changed files with 20 additions and 3 deletions
|
@ -18,6 +18,7 @@ Bugfix 🐛:
|
||||||
- Tapping drawer having more than 1 room in notifications gives "malformed link" error (#2605)
|
- Tapping drawer having more than 1 room in notifications gives "malformed link" error (#2605)
|
||||||
- Sent image not displayed when opened immediately after sending (#409)
|
- Sent image not displayed when opened immediately after sending (#409)
|
||||||
- Initial sync is not retried correctly when there is some network error. (#2632)
|
- Initial sync is not retried correctly when there is some network error. (#2632)
|
||||||
|
- Fix request too large Uri error when joining a room
|
||||||
|
|
||||||
Translations 🗣:
|
Translations 🗣:
|
||||||
-
|
-
|
||||||
|
|
|
@ -55,7 +55,11 @@ internal class DefaultJoinRoomTask @Inject constructor(
|
||||||
roomChangeMembershipStateDataSource.updateState(params.roomIdOrAlias, ChangeMembershipState.Joining)
|
roomChangeMembershipStateDataSource.updateState(params.roomIdOrAlias, ChangeMembershipState.Joining)
|
||||||
val joinRoomResponse = try {
|
val joinRoomResponse = try {
|
||||||
executeRequest<JoinRoomResponse>(globalErrorReceiver) {
|
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) {
|
} catch (failure: Throwable) {
|
||||||
roomChangeMembershipStateDataSource.updateState(params.roomIdOrAlias, ChangeMembershipState.FailedJoining(failure))
|
roomChangeMembershipStateDataSource.updateState(params.roomIdOrAlias, ChangeMembershipState.FailedJoining(failure))
|
||||||
|
|
|
@ -84,22 +84,34 @@ class RoomPreviewViewModel @AssistedInject constructor(@Assisted private val ini
|
||||||
when (peekResult) {
|
when (peekResult) {
|
||||||
is PeekResult.Success -> {
|
is PeekResult.Success -> {
|
||||||
setState {
|
setState {
|
||||||
|
// Do not override what we had from the permalink
|
||||||
|
val newHomeServers = if (homeServers.isEmpty()) {
|
||||||
|
peekResult.viaServers.take(3)
|
||||||
|
} else {
|
||||||
|
homeServers
|
||||||
|
}
|
||||||
copy(
|
copy(
|
||||||
roomId = peekResult.roomId,
|
roomId = peekResult.roomId,
|
||||||
avatarUrl = peekResult.avatarUrl,
|
avatarUrl = peekResult.avatarUrl,
|
||||||
roomAlias = peekResult.alias ?: initialState.roomAlias,
|
roomAlias = peekResult.alias ?: initialState.roomAlias,
|
||||||
roomTopic = peekResult.topic,
|
roomTopic = peekResult.topic,
|
||||||
homeServers = peekResult.viaServers,
|
homeServers = newHomeServers,
|
||||||
peekingState = Success(PeekingState.FOUND)
|
peekingState = Success(PeekingState.FOUND)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is PeekResult.PeekingNotAllowed -> {
|
is PeekResult.PeekingNotAllowed -> {
|
||||||
setState {
|
setState {
|
||||||
|
// Do not override what we had from the permalink
|
||||||
|
val newHomeServers = if (homeServers.isEmpty()) {
|
||||||
|
peekResult.viaServers.take(3)
|
||||||
|
} else {
|
||||||
|
homeServers
|
||||||
|
}
|
||||||
copy(
|
copy(
|
||||||
roomId = peekResult.roomId,
|
roomId = peekResult.roomId,
|
||||||
roomAlias = peekResult.alias ?: initialState.roomAlias,
|
roomAlias = peekResult.alias ?: initialState.roomAlias,
|
||||||
homeServers = peekResult.viaServers,
|
homeServers = newHomeServers,
|
||||||
peekingState = Success(PeekingState.NO_ACCESS)
|
peekingState = Success(PeekingState.NO_ACCESS)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue