diff --git a/skins/base/views/organisms/UserSettings.js b/skins/base/views/organisms/UserSettings.js
index e90953ae..9afa3c03 100644
--- a/skins/base/views/organisms/UserSettings.js
+++ b/skins/base/views/organisms/UserSettings.js
@@ -25,7 +25,7 @@ var ChangePassword = ComponentBroker.get('molecules/ChangePassword');
var LogoutPrompt = ComponentBroker.get('organisms/LogoutPrompt');
var Loader = require("react-loader");
-var Modal = require("../../../../src/Modal")
+var Modal = require("../../../../src/Modal");
module.exports = React.createClass({
displayName: 'UserSettings',
diff --git a/skins/base/views/templates/Register.js b/skins/base/views/templates/Register.js
index 346b40f8..784db4cf 100644
--- a/skins/base/views/templates/Register.js
+++ b/skins/base/views/templates/Register.js
@@ -182,7 +182,7 @@ module.exports = React.createClass({
-
+
{this.registerContent()}
diff --git a/src/CallHandler.js b/src/CallHandler.js
index ffc93500..671d8278 100644
--- a/src/CallHandler.js
+++ b/src/CallHandler.js
@@ -54,6 +54,9 @@ limitations under the License.
*/
var MatrixClientPeg = require("./MatrixClientPeg");
+var Modal = require("./Modal");
+var ComponentBroker = require('./ComponentBroker');
+var ErrorDialog = ComponentBroker.get("organisms/ErrorDialog");
var Matrix = require("matrix-js-sdk");
var dis = require("./dispatcher");
@@ -154,7 +157,12 @@ dis.register(function(payload) {
console.error("Room %s does not exist.", payload.room_id);
return;
}
- if (room.getJoinedMembers().length !== 2) {
+ var members = room.getJoinedMembers();
+ if (members.length !== 2) {
+ var text = members.length === 1 ? "yourself." : "more than 2 people.";
+ Modal.createDialog(ErrorDialog, {
+ description: "You cannot place a call with " + text
+ });
console.error(
"Fail: There are %s joined members in this room, not 2.",
room.getJoinedMembers().length
diff --git a/src/ComponentBroker.js b/src/ComponentBroker.js
index 56164d3d..a9ccebd1 100644
--- a/src/ComponentBroker.js
+++ b/src/ComponentBroker.js
@@ -110,4 +110,5 @@ require('../skins/base/views/molecules/voip/MCallAnswerTile');
require('../skins/base/views/molecules/voip/MCallHangupTile');
require('../skins/base/views/molecules/EventAsTextTile');
require('../skins/base/views/molecules/MemberInfo');
+require('../skins/base/views/organisms/ErrorDialog');
}
diff --git a/src/Modal.js b/src/Modal.js
index ca11a210..a8331e55 100644
--- a/src/Modal.js
+++ b/src/Modal.js
@@ -44,6 +44,8 @@ module.exports = {
if (props && props.onFinished) props.onFinished.apply(arguments);
};
+ // FIXME: If a dialog uses getDefaultProps it clobbers the onFinished
+ // property set here so you can't close the dialog from a button click!
var dialog = (
diff --git a/src/SlashCommands.js b/src/SlashCommands.js
index 26a14687..2ddebd7d 100644
--- a/src/SlashCommands.js
+++ b/src/SlashCommands.js
@@ -100,22 +100,18 @@ var commands = {
else {
// attempt to join this alias.
return success(
- MatrixClientPeg.get().joinRoom(room_alias).done(
+ MatrixClientPeg.get().joinRoom(room_alias).then(
function(room) {
dis.dispatch({
action: 'view_room',
room_id: room.roomId
});
- }, function(err) {
- console.error(
- "Failed to join room: %s", JSON.stringify(err)
- );
})
);
}
}
}
- return reject("Usage: /join [NOT IMPLEMENTED]");
+ return reject("Usage: /join ");
},
// Kick a user from the room with an optional reason
diff --git a/src/controllers/molecules/MessageComposer.js b/src/controllers/molecules/MessageComposer.js
index 066cdd64..0fa80665 100644
--- a/src/controllers/molecules/MessageComposer.js
+++ b/src/controllers/molecules/MessageComposer.js
@@ -18,6 +18,9 @@ limitations under the License.
var MatrixClientPeg = require("../../MatrixClientPeg");
var SlashCommands = require("../../SlashCommands");
+var Modal = require("../../Modal");
+var ComponentBroker = require('../../ComponentBroker');
+var ErrorDialog = ComponentBroker.get("organisms/ErrorDialog");
var dis = require("../../dispatcher");
var KeyCode = {
@@ -196,10 +199,18 @@ module.exports = {
console.log("Command success.");
}, function(err) {
console.error("Command failure: %s", err);
+ Modal.createDialog(ErrorDialog, {
+ title: "Server Error",
+ description: err.message
+ });
});
}
else if (cmd.error) {
console.error(cmd.error);
+ Modal.createDialog(ErrorDialog, {
+ title: "Command Error",
+ description: cmd.error
+ });
}
return;
}