From 63c63bc46241163eb5fbd5ccd9168b478d3269fa Mon Sep 17 00:00:00 2001 From: Claire Gizard Date: Tue, 4 Jan 2022 13:49:18 +0100 Subject: [PATCH] Update error message when joining room --- changelog.d/4847.bugfix | 1 + .../src/main/java/im/vector/app/core/error/ErrorFormatter.kt | 4 ++++ vector/src/main/res/values/strings.xml | 1 + 3 files changed, 6 insertions(+) create mode 100644 changelog.d/4847.bugfix diff --git a/changelog.d/4847.bugfix b/changelog.d/4847.bugfix new file mode 100644 index 0000000000..d311882934 --- /dev/null +++ b/changelog.d/4847.bugfix @@ -0,0 +1 @@ +Translate the error observed when the user is not allowed to join a room \ No newline at end of file diff --git a/vector/src/main/java/im/vector/app/core/error/ErrorFormatter.kt b/vector/src/main/java/im/vector/app/core/error/ErrorFormatter.kt index 6494f31336..8640fa6f05 100644 --- a/vector/src/main/java/im/vector/app/core/error/ErrorFormatter.kt +++ b/vector/src/main/java/im/vector/app/core/error/ErrorFormatter.kt @@ -100,6 +100,10 @@ class DefaultErrorFormatter @Inject constructor( throwable.error.code == MatrixError.M_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 -> { throwable.error.message.takeIf { it.isNotEmpty() } ?: throwable.error.code.takeIf { it.isNotEmpty() } diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 34ac5fcddc..26daeeed83 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -169,6 +169,7 @@ It is not currently possible to re-join an empty room. + You are not allowed to join this room Email address