Adding better deafults and ErrorDialog message

pull/21833/head
wmwragg 2016-09-05 14:29:21 +01:00
parent 3d66dff0aa
commit d9c6448a0f
2 changed files with 8 additions and 5 deletions

View File

@ -513,8 +513,6 @@ module.exports = React.createClass({
var ChatInviteDialog = sdk.getComponent("dialogs.ChatInviteDialog"); var ChatInviteDialog = sdk.getComponent("dialogs.ChatInviteDialog");
Modal.createDialog(ChatInviteDialog, { Modal.createDialog(ChatInviteDialog, {
title: "Start a one to one chat", title: "Start a one to one chat",
description: "Who would you like to communicate with?",
placeholder: "User ID, Name or email",
}); });
}, },

View File

@ -29,6 +29,7 @@ module.exports = React.createClass({
React.PropTypes.string, React.PropTypes.string,
]), ]),
value: React.PropTypes.string, value: React.PropTypes.string,
placeholder: React.PropTypes.string,
button: React.PropTypes.string, button: React.PropTypes.string,
focus: React.PropTypes.bool, focus: React.PropTypes.bool,
onFinished: React.PropTypes.func.isRequired onFinished: React.PropTypes.func.isRequired
@ -36,9 +37,10 @@ module.exports = React.createClass({
getDefaultProps: function() { getDefaultProps: function() {
return { return {
title: "", title: "Start a chat",
description: "Who would you like to communicate with?",
value: "", value: "",
description: "", placeholder: "User ID, Name or email",
button: "Start Chat", button: "Start Chat",
focus: true focus: true
}; };
@ -56,18 +58,21 @@ module.exports = React.createClass({
}, },
_startChat: function(addr) { _startChat: function(addr) {
// Start the chat
createRoom().then(function(roomId) { createRoom().then(function(roomId) {
return Invite.inviteToRoom(roomId, addr); return Invite.inviteToRoom(roomId, addr);
}) })
.catch(function(err) { .catch(function(err) {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Failure to invite " + addr, title: "Failure to invite user",
description: err.toString() description: err.toString()
}); });
return null; return null;
}) })
.done(); .done();
// Close - this will happen before the above, as that is async
this.props.onFinished(true, addr); this.props.onFinished(true, addr);
}, },