diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js
index df74cf5de1..debfca3388 100644
--- a/src/components/structures/MatrixChat.js
+++ b/src/components/structures/MatrixChat.js
@@ -64,7 +64,7 @@ module.exports = React.createClass({
collapse_lhs: false,
collapse_rhs: false,
ready: false,
- width: 10000
+ width: 10000,
};
if (s.logged_in) {
if (MatrixClientPeg.get().getRooms().length) {
@@ -304,7 +304,7 @@ module.exports = React.createClass({
});
break;
case 'view_room':
- this._viewRoom(payload.room_id);
+ this._viewRoom(payload.room_id, payload.show_settings);
break;
case 'view_prev_room':
roomIndexDelta = -1;
@@ -357,8 +357,29 @@ module.exports = React.createClass({
this.notifyNewScreen('settings');
break;
case 'view_create_room':
- this._setPage(this.PageTypes.CreateRoom);
- this.notifyNewScreen('new');
+ //this._setPage(this.PageTypes.CreateRoom);
+ //this.notifyNewScreen('new');
+
+ var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
+ var Loader = sdk.getComponent("elements.Spinner");
+ var modal = Modal.createDialog(Loader);
+
+ MatrixClientPeg.get().createRoom({
+ preset: "private_chat"
+ }).done(function(res) {
+ modal.close();
+ dis.dispatch({
+ action: 'view_room',
+ room_id: res.room_id,
+ show_settings: true,
+ });
+ }, function(err) {
+ modal.close();
+ Modal.createDialog(ErrorDialog, {
+ title: "Failed to create room",
+ description: err.toString()
+ });
+ });
break;
case 'view_room_directory':
this._setPage(this.PageTypes.RoomDirectory);
@@ -399,7 +420,7 @@ module.exports = React.createClass({
});
},
- _viewRoom: function(roomId) {
+ _viewRoom: function(roomId, showSettings) {
// before we switch room, record the scroll state of the current room
this._updateScrollMap();
@@ -437,6 +458,9 @@ module.exports = React.createClass({
var scrollState = this.scrollStateMap[roomId];
this.refs.roomView.restoreScrollState(scrollState);
}
+ if (this.refs.roomView && showSettings) {
+ this.refs.roomView.showSettings(true);
+ }
},
// update scrollStateMap according to the current scroll state of the
diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js
index 0688b98ca5..c65a94ecfe 100644
--- a/src/components/structures/RoomView.js
+++ b/src/components/structures/RoomView.js
@@ -79,7 +79,7 @@ module.exports = React.createClass({
hasUnsentMessages: this._hasUnsentMessages(room),
callState: null,
guestsCanJoin: false,
- readMarkerEventId: room.getEventReadUpTo(MatrixClientPeg.get().credentials.userId),
+ readMarkerEventId: room ? room.getEventReadUpTo(MatrixClientPeg.get().credentials.userId) : undefined,
readMarkerGhostEventId: undefined
}
},
@@ -894,7 +894,7 @@ module.exports = React.createClass({
old_guest_join = (old_guest_join.getContent().guest_access === "can_join");
}
else {
- old_guest_join = (old_guest_join.getContent().guest_access === "forbidden");
+ old_guest_join = false;
}
var old_canonical_alias = this.state.room.currentState.getStateEvents('m.room.canonical_alias', '');
@@ -1337,6 +1337,13 @@ module.exports = React.createClass({
}
},
+ showSettings: function(show) {
+ // XXX: this is a bit naughty; we should be doing this via props
+ if (show) {
+ this.setState({editingRoomSettings: true});
+ }
+ },
+
render: function() {
var RoomHeader = sdk.getComponent('rooms.RoomHeader');
var MessageComposer = sdk.getComponent('rooms.MessageComposer');
@@ -1487,7 +1494,7 @@ module.exports = React.createClass({
var aux = null;
if (this.state.editingRoomSettings) {
- aux =