Remove unnecessary Modal.createDialogWithElement, complete with its broken onFinished() support. Switch SetDisplayNameDialog to use Modal.createDialog(). Explicitly pass false to closeDialog if the user tries to cancel dialogs by clicking on the background, rather than passing in an event object which evaluates to true.
This commit is contained in:
parent
e63990a66e
commit
deaa5c350a
2 changed files with 20 additions and 35 deletions
|
@ -522,16 +522,22 @@ module.exports = React.createClass({
|
|||
var SetDisplayNameDialog = sdk.getComponent('views.dialogs.SetDisplayNameDialog');
|
||||
var dialog_defer = q.defer();
|
||||
var dialog_ref;
|
||||
var modal;
|
||||
var dialog_instance = <SetDisplayNameDialog currentDisplayName={result.displayname} ref={(r) => {
|
||||
Modal.createDialog(SetDisplayNameDialog, {
|
||||
currentDisplayName: result.displayname,
|
||||
ref: (r) => {
|
||||
dialog_ref = r;
|
||||
}} onFinished={() => {
|
||||
cli.setDisplayName(dialog_ref.getValue()).done(() => {
|
||||
dialog_defer.resolve();
|
||||
});
|
||||
modal.close();
|
||||
}} />
|
||||
modal = Modal.createDialogWithElement(dialog_instance);
|
||||
},
|
||||
onFinished: (submitted) => {
|
||||
if (submitted) {
|
||||
cli.setDisplayName(dialog_ref.getValue()).done(() => {
|
||||
dialog_defer.resolve();
|
||||
});
|
||||
}
|
||||
else {
|
||||
dialog_defer.reject();
|
||||
}
|
||||
}
|
||||
});
|
||||
return dialog_defer.promise;
|
||||
}
|
||||
});
|
||||
|
@ -561,6 +567,8 @@ module.exports = React.createClass({
|
|||
joining: false,
|
||||
joinError: error
|
||||
});
|
||||
|
||||
if (!error) return;
|
||||
var msg = error.message ? error.message : JSON.stringify(error);
|
||||
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
||||
Modal.createDialog(ErrorDialog, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue