Update error message when joining room

This commit is contained in:
Claire Gizard 2022-01-04 13:49:18 +01:00
parent 5340d16e1f
commit 63c63bc462
3 changed files with 6 additions and 0 deletions

1
changelog.d/4847.bugfix Normal file
View file

@ -0,0 +1 @@
Translate the error observed when the user is not allowed to join a room

View file

@ -100,6 +100,10 @@ class DefaultErrorFormatter @Inject constructor(
throwable.error.code == MatrixError.M_THREEPID_AUTH_FAILED -> { throwable.error.code == MatrixError.M_THREEPID_AUTH_FAILED -> {
stringProvider.getString(R.string.error_threepid_auth_failed) stringProvider.getString(R.string.error_threepid_auth_failed)
} }
throwable.error.code == MatrixError.M_UNKNOWN &&
throwable.error.message == "Not allowed to join this room" -> {
stringProvider.getString(R.string.room_error_access_unauthorized)
}
else -> { else -> {
throwable.error.message.takeIf { it.isNotEmpty() } throwable.error.message.takeIf { it.isNotEmpty() }
?: throwable.error.code.takeIf { it.isNotEmpty() } ?: throwable.error.code.takeIf { it.isNotEmpty() }

View file

@ -169,6 +169,7 @@
<!-- room error messages --> <!-- room error messages -->
<string name="room_error_join_failed_empty_room">It is not currently possible to re-join an empty room.</string> <string name="room_error_join_failed_empty_room">It is not currently possible to re-join an empty room.</string>
<string name="room_error_access_unauthorized">You are not allowed to join this room</string>
<!-- medium friendly name --> <!-- medium friendly name -->
<string name="medium_email">Email address</string> <string name="medium_email">Email address</string>