From ad87e9bd50b46857ce028780d367bfe4258a6608 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 5 Jun 2017 17:28:36 +0100 Subject: [PATCH 1/2] Apply https://github.com/matrix-org/matrix-react-sdk/commit/9cae667c063e67b32e60b89e7256d714a056559b to ilag branch --- src/components/views/elements/CreateRoomButton.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/elements/CreateRoomButton.js b/src/components/views/elements/CreateRoomButton.js index f98974b489..22d222c6f1 100644 --- a/src/components/views/elements/CreateRoomButton.js +++ b/src/components/views/elements/CreateRoomButton.js @@ -22,7 +22,7 @@ import { _t } from '../../../languageHandler'; const CreateRoomButton = function(props) { const ActionButton = sdk.getComponent('elements.ActionButton'); return ( - Date: Mon, 5 Jun 2017 17:45:01 +0100 Subject: [PATCH 2/2] Defer an intention for creating a room --- src/components/structures/MatrixChat.js | 44 +++++++++++++++---------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 3c0552b84b..3fbb18aeda 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -325,7 +325,6 @@ module.exports = React.createClass({ onAction: function(payload) { const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); - const TextInputDialog = sdk.getComponent("dialogs.TextInputDialog"); switch (payload.action) { case 'logout': @@ -457,22 +456,7 @@ module.exports = React.createClass({ this.notifyNewScreen('settings'); break; case 'view_create_room': - if (MatrixClientPeg.get().isGuest()) { - dis.dispatch({action: 'view_set_mxid'}); - break; - } - Modal.createDialog(TextInputDialog, { - title: _t('Create Room'), - description: _t('Room name (optional)'), - button: _t('Create Room'), - onFinished: (should_create, name) => { - if (should_create) { - const createOpts = {}; - if (name) createOpts.name = name; - createRoom({createOpts}).done(); - } - }, - }); + this._createRoom(); break; case 'view_room_directory': this._setPage(PageTypes.RoomDirectory); @@ -727,6 +711,32 @@ module.exports = React.createClass({ }); }, + _createRoom: function() { + if (MatrixClientPeg.get().isGuest()) { + dis.dispatch({ + action: 'do_after_sync_prepared', + deferred_action: { + action: 'view_create_room', + }, + }); + dis.dispatch({action: 'view_set_mxid'}); + return; + } + const TextInputDialog = sdk.getComponent("dialogs.TextInputDialog"); + Modal.createDialog(TextInputDialog, { + title: _t('Create Room'), + description: _t('Room name (optional)'), + button: _t('Create Room'), + onFinished: (should_create, name) => { + if (should_create) { + const createOpts = {}; + if (name) createOpts.name = name; + createRoom({createOpts}).done(); + } + }, + }); + }, + _chatCreateOrReuse: function(userId) { const ChatCreateOrReuseDialog = sdk.getComponent( 'views.dialogs.ChatCreateOrReuseDialog',