diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index c16b80ec62..459847ce88 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -464,9 +464,18 @@ module.exports = React.createClass({ //this.notifyNewScreen('new'); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + var NeedToRegisterDialog = sdk.getComponent("dialogs.NeedToRegisterDialog"); var Loader = sdk.getComponent("elements.Spinner"); var modal = Modal.createDialog(Loader); + if (MatrixClientPeg.get().isGuest) { + Modal.createDialog(NeedToRegisterDialog, { + title: "Please Register", + description: "Guest users can't create new rooms. Please register to create room and start a chat." + }); + return; + } + // XXX: FIXME: deduplicate this with MemberInfo's 'start chat' impl MatrixClientPeg.get().createRoom({ preset: "private_chat", diff --git a/src/components/views/rooms/MemberInfo.js b/src/components/views/rooms/MemberInfo.js index 196e3e4c5f..a79d90adbc 100644 --- a/src/components/views/rooms/MemberInfo.js +++ b/src/components/views/rooms/MemberInfo.js @@ -293,6 +293,16 @@ module.exports = React.createClass({ } else { self.setState({ creatingRoom: true }); + + if (MatrixClientPeg.get().isGuest()) { + var NeedToRegisterDialog = sdk.getComponent("dialogs.NeedToRegisterDialog"); + Modal.createDialog(NeedToRegisterDialog, { + title: "Please Register", + description: "Guest users can't create new rooms. Please register to create room and start a chat." + }); + return; + } + MatrixClientPeg.get().createRoom({ // XXX: FIXME: deduplicate this with "view_create_room" in MatrixChat invite: [this.props.member.userId],