fix self/this crash, and don't let guests invite
This commit is contained in:
parent
736b6dac7a
commit
671eacaac7
1 changed files with 13 additions and 1 deletions
|
@ -213,15 +213,25 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
_startChat: function(addrs) {
|
_startChat: function(addrs) {
|
||||||
|
if (MatrixClientPeg.get().isGuest()) {
|
||||||
|
var NeedToRegisterDialog = sdk.getComponent("dialogs.NeedToRegisterDialog");
|
||||||
|
Modal.createDialog(NeedToRegisterDialog, {
|
||||||
|
title: "Please Register",
|
||||||
|
description: "Guest users can't invite users. Please register."
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.props.roomId) {
|
if (this.props.roomId) {
|
||||||
// Invite new user to a room
|
// Invite new user to a room
|
||||||
var self = this;
|
var self = this;
|
||||||
Invite.inviteMultipleToRoom(this.props.roomId, addrs)
|
Invite.inviteMultipleToRoom(this.props.roomId, addrs)
|
||||||
.then(function(addrs) {
|
.then(function(addrs) {
|
||||||
var room = MatrixClientPeg.get().getRoom(this.props.roomId);
|
var room = MatrixClientPeg.get().getRoom(self.props.roomId);
|
||||||
return self._showAnyInviteErrors(addrs, room);
|
return self._showAnyInviteErrors(addrs, room);
|
||||||
})
|
})
|
||||||
.catch(function(err) {
|
.catch(function(err) {
|
||||||
|
console.error(err.stack);
|
||||||
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
||||||
Modal.createDialog(ErrorDialog, {
|
Modal.createDialog(ErrorDialog, {
|
||||||
title: "Failure to invite",
|
title: "Failure to invite",
|
||||||
|
@ -234,6 +244,7 @@ module.exports = React.createClass({
|
||||||
// Start the DM chat
|
// Start the DM chat
|
||||||
createRoom({dmUserId: addrs[0]})
|
createRoom({dmUserId: addrs[0]})
|
||||||
.catch(function(err) {
|
.catch(function(err) {
|
||||||
|
console.error(err.stack);
|
||||||
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
||||||
Modal.createDialog(ErrorDialog, {
|
Modal.createDialog(ErrorDialog, {
|
||||||
title: "Failure to invite user",
|
title: "Failure to invite user",
|
||||||
|
@ -254,6 +265,7 @@ module.exports = React.createClass({
|
||||||
return self._showAnyInviteErrors(addrs, room);
|
return self._showAnyInviteErrors(addrs, room);
|
||||||
})
|
})
|
||||||
.catch(function(err) {
|
.catch(function(err) {
|
||||||
|
console.error(err.stack);
|
||||||
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
||||||
Modal.createDialog(ErrorDialog, {
|
Modal.createDialog(ErrorDialog, {
|
||||||
title: "Failure to invite",
|
title: "Failure to invite",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue