From 9d2f223773a3c73a7eec78d200266672033b93e8 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 24 May 2018 16:54:48 +0100 Subject: [PATCH] Message for leaving server notices room --- src/components/structures/MatrixChat.js | 16 +++++++++++++--- src/i18n/strings/en_EN.json | 2 ++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 96e721f7ca..a3b243f8bc 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -996,10 +996,20 @@ export default React.createClass({ }, (err) => { modal.close(); console.error("Failed to leave room " + roomId + " " + err); + let title = _t("Failed to leave room"); + let message = _t("Server may be unavailable, overloaded, or you hit a bug."); + if (err.errcode == 'M_CANNOT_LEAVE_SERVER_NOTICE_ROOM') { + title = _t("Can't leave Server Notices room"); + message = _t( + "This room is used for important messages from the Home Server, " + + "so you cannot leave it.", + ); + } else if (err && err.message) { + message = err.message; + } Modal.createTrackedDialog('Failed to leave room', '', ErrorDialog, { - title: _t("Failed to leave room"), - description: (err && err.message ? err.message : - _t("Server may be unavailable, overloaded, or you hit a bug.")), + title: title, + description: message, }); }); } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 41f1780425..f334a94d4e 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -949,6 +949,8 @@ "This room is not public. You will not be able to rejoin without an invite.": "This room is not public. You will not be able to rejoin without an invite.", "Are you sure you want to leave the room '%(roomName)s'?": "Are you sure you want to leave the room '%(roomName)s'?", "Failed to leave room": "Failed to leave room", + "Can't leave Server Notices room": "Can't leave Server Notices room", + "This room is used for important messages from the Home Server, so you cannot leave it.": "This room is used for important messages from the Home Server, so you cannot leave it.", "Signed Out": "Signed Out", "For security, this session has been signed out. Please sign in again.": "For security, this session has been signed out. Please sign in again.", "Terms and Conditions": "Terms and Conditions",