You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-18 09:22:18 +03:00
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:
@ -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, {
|
||||
|
Reference in New Issue
Block a user