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 2bebefeef2..9886a9f009 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