Merge pull request #4848 from vector-im/cgizard/translate_error_message_joining_room

Update error message when joining room
This commit is contained in:
Benoit Marty 2022-01-04 15:27:49 +01:00 committed by GitHub
commit ed00f9f712
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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>