From 13f31b2a5ddc1b46b39caaf694477034e281f5a2 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 22 Mar 2016 13:47:29 +0000 Subject: [PATCH] Add error message for failing to join a room as a guest (which may or may not be because we're a guest: we can't tell) --- src/components/structures/RoomView.js | 28 +++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 4598b7b9c8..7f4d8ea91a 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -575,12 +575,28 @@ module.exports = React.createClass({ }); if (!error) return; - var msg = error.message ? error.message : JSON.stringify(error); - var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); - Modal.createDialog(ErrorDialog, { - title: "Failed to join room", - description: msg - }); + + // https://matrix.org/jira/browse/SYN-659 + if ( + error.errcode == 'M_GUEST_ACCESS_FORBIDDEN' || + ( + error.errcode == 'M_FORBIDDEN' && + MatrixClientPeg.get().isGuest() + ) + ) { + var NeedToRegisterDialog = sdk.getComponent("dialogs.NeedToRegisterDialog"); + Modal.createDialog(NeedToRegisterDialog, { + title: "Failed to join the room", + description: "This room is private or inaccessible to guests. You may be able to join if you register." + }); + } else { + var msg = error.message ? error.message : JSON.stringify(error); + var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + Modal.createDialog(ErrorDialog, { + title: "Failed to join room", + description: msg + }); + } }); this.setState({ joining: true