Added the room name to the error message

This commit is contained in:
wmwragg 2016-09-14 16:28:44 +01:00
parent 435570a022
commit a06896f96c

View file

@ -214,7 +214,8 @@ module.exports = React.createClass({
var self = this; var self = this;
Invite.inviteMultipleToRoom(this.props.roomId, addrs) Invite.inviteMultipleToRoom(this.props.roomId, addrs)
.then(function(addrs) { .then(function(addrs) {
return self._showAnyInviteErrors(addrs); var room = MatrixClientPeg.get().getRoom(this.props.roomId);
return self._showAnyInviteErrors(addrs, room);
}) })
.catch(function(err) { .catch(function(err) {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
@ -240,11 +241,13 @@ module.exports = React.createClass({
} else { } else {
// Start multi user chat // Start multi user chat
var self = this; var self = this;
var room;
createRoom().then(function(roomId) { createRoom().then(function(roomId) {
room = MatrixClientPeg.get().getRoom(roomId);
return Invite.inviteMultipleToRoom(roomId, addrs); return Invite.inviteMultipleToRoom(roomId, addrs);
}) })
.then(function(addrs) { .then(function(addrs) {
return self._showAnyInviteErrors(addrs); return self._showAnyInviteErrors(addrs, room);
}) })
.catch(function(err) { .catch(function(err) {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
@ -319,7 +322,7 @@ module.exports = React.createClass({
} }
}, },
_showAnyInviteErrors: function(addrs) { _showAnyInviteErrors: function(addrs, room) {
// Show user any errors // Show user any errors
var errorList = []; var errorList = [];
for (var addr in addrs) { for (var addr in addrs) {
@ -327,10 +330,11 @@ module.exports = React.createClass({
errorList.push(addr); errorList.push(addr);
} }
} }
if (errorList.length > 0) { if (errorList.length > 0) {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Failed to invite the following users:", title: "Failed to invite the following users to the " + room.name + " room:",
description: errorList.join(", "), description: errorList.join(", "),
}); });
} }