Prevent ROUs from creating new chats/new rooms
Spawn a SetMxIdDialog instead and do nothing.
This commit is contained in:
parent
5151264f60
commit
6326a95b39
1 changed files with 32 additions and 6 deletions
|
@ -502,21 +502,23 @@ module.exports = React.createClass({
|
||||||
this.notifyNewScreen('settings');
|
this.notifyNewScreen('settings');
|
||||||
break;
|
break;
|
||||||
case 'view_create_room':
|
case 'view_create_room':
|
||||||
//this._setPage(PageTypes.CreateRoom);
|
if (MatrixClientPeg.get().isGuest()) {
|
||||||
//this.notifyNewScreen('new');
|
dis.dispatch({action: 'view_set_mxid'});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
var TextInputDialog = sdk.getComponent("dialogs.TextInputDialog");
|
var TextInputDialog = sdk.getComponent("dialogs.TextInputDialog");
|
||||||
Modal.createDialog(TextInputDialog, {
|
Modal.createDialog(TextInputDialog, {
|
||||||
title: "Create Room",
|
title: "Create Room",
|
||||||
description: "Room name (optional)",
|
description: "Room name (optional)",
|
||||||
button: "Create Room",
|
button: "Create Room",
|
||||||
onFinished: (should_create, name) => {
|
onFinished: (shouldCreate, name) => {
|
||||||
if (should_create) {
|
if (shouldCreate) {
|
||||||
const createOpts = {};
|
const createOpts = {};
|
||||||
if (name) createOpts.name = name;
|
if (name) createOpts.name = name;
|
||||||
createRoom({createOpts}).done();
|
createRoom({createOpts}).done();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'view_room_directory':
|
case 'view_room_directory':
|
||||||
|
@ -531,6 +533,9 @@ module.exports = React.createClass({
|
||||||
this._setPage(PageTypes.HomePage);
|
this._setPage(PageTypes.HomePage);
|
||||||
this.notifyNewScreen('home');
|
this.notifyNewScreen('home');
|
||||||
break;
|
break;
|
||||||
|
case 'view_set_mxid':
|
||||||
|
this._setMxId();
|
||||||
|
break;
|
||||||
case 'view_create_chat':
|
case 'view_create_chat':
|
||||||
this._createChat();
|
this._createChat();
|
||||||
break;
|
break;
|
||||||
|
@ -679,8 +684,29 @@ module.exports = React.createClass({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_setMxId: function() {
|
||||||
|
const SetMxIdDialog = sdk.getComponent('views.dialogs.SetMxIdDialog');
|
||||||
|
const close = Modal.createDialog(SetMxIdDialog, {
|
||||||
|
homeserverUrl: MatrixClientPeg.get().getHomeserverUrl(),
|
||||||
|
onFinished: (submitted, credentials) => {
|
||||||
|
if (!submitted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.onRegistered(credentials);
|
||||||
|
},
|
||||||
|
onDifferentServerClicked: (ev) => {
|
||||||
|
dis.dispatch({action: 'start_registration'});
|
||||||
|
close();
|
||||||
|
},
|
||||||
|
}).close;
|
||||||
|
},
|
||||||
|
|
||||||
_createChat: function() {
|
_createChat: function() {
|
||||||
var ChatInviteDialog = sdk.getComponent("dialogs.ChatInviteDialog");
|
if (MatrixClientPeg.get().isGuest()) {
|
||||||
|
dis.dispatch({action: 'view_set_mxid'});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const ChatInviteDialog = sdk.getComponent("dialogs.ChatInviteDialog");
|
||||||
Modal.createDialog(ChatInviteDialog, {
|
Modal.createDialog(ChatInviteDialog, {
|
||||||
title: "Start a new chat",
|
title: "Start a new chat",
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue