mirror of https://github.com/vector-im/riot-web
Merge branch 'new-guest-access' into luke/ilag-i18n
commit
4ab6dc9ddd
|
@ -325,7 +325,6 @@ module.exports = React.createClass({
|
||||||
onAction: function(payload) {
|
onAction: function(payload) {
|
||||||
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
||||||
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
||||||
const TextInputDialog = sdk.getComponent("dialogs.TextInputDialog");
|
|
||||||
|
|
||||||
switch (payload.action) {
|
switch (payload.action) {
|
||||||
case 'logout':
|
case 'logout':
|
||||||
|
@ -457,22 +456,7 @@ module.exports = React.createClass({
|
||||||
this.notifyNewScreen('settings');
|
this.notifyNewScreen('settings');
|
||||||
break;
|
break;
|
||||||
case 'view_create_room':
|
case 'view_create_room':
|
||||||
if (MatrixClientPeg.get().isGuest()) {
|
this._createRoom();
|
||||||
dis.dispatch({action: 'view_set_mxid'});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Modal.createDialog(TextInputDialog, {
|
|
||||||
title: _t('Create Room'),
|
|
||||||
description: _t('Room name (optional)'),
|
|
||||||
button: _t('Create Room'),
|
|
||||||
onFinished: (shouldCreate, name) => {
|
|
||||||
if (shouldCreate) {
|
|
||||||
const createOpts = {};
|
|
||||||
if (name) createOpts.name = name;
|
|
||||||
createRoom({createOpts}).done();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
case 'view_room_directory':
|
case 'view_room_directory':
|
||||||
this._setPage(PageTypes.RoomDirectory);
|
this._setPage(PageTypes.RoomDirectory);
|
||||||
|
@ -732,6 +716,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) {
|
_chatCreateOrReuse: function(userId) {
|
||||||
const ChatCreateOrReuseDialog = sdk.getComponent(
|
const ChatCreateOrReuseDialog = sdk.getComponent(
|
||||||
'views.dialogs.ChatCreateOrReuseDialog',
|
'views.dialogs.ChatCreateOrReuseDialog',
|
||||||
|
|
|
@ -22,7 +22,7 @@ import { _t } from '../../../languageHandler';
|
||||||
const CreateRoomButton = function(props) {
|
const CreateRoomButton = function(props) {
|
||||||
const ActionButton = sdk.getComponent('elements.ActionButton');
|
const ActionButton = sdk.getComponent('elements.ActionButton');
|
||||||
return (
|
return (
|
||||||
<ActionButton action="view_create_chat"
|
<ActionButton action="view_create_room"
|
||||||
mouseOverAction={props.callout ? "callout_create_room" : null}
|
mouseOverAction={props.callout ? "callout_create_room" : null}
|
||||||
label={ _t("Create new room") }
|
label={ _t("Create new room") }
|
||||||
iconPath="img/icons-create-room.svg"
|
iconPath="img/icons-create-room.svg"
|
||||||
|
|
Loading…
Reference in New Issue