Fix SetDisplayNameDialog

SetDisplayNameDialog got broken by the changes to support asynchronous loading
of dialogs.

Rather than poking into its internals via a ref, make it return its result via
onFinished.

Fixes https://github.com/vector-im/riot-web/issues/3047
This commit is contained in:
Richard van der Hoff 2017-01-25 08:01:45 +00:00
parent 770820e6fa
commit 29b4dde878
2 changed files with 9 additions and 11 deletions

View file

@ -722,15 +722,11 @@ module.exports = React.createClass({
if (!result.displayname) {
var SetDisplayNameDialog = sdk.getComponent('views.dialogs.SetDisplayNameDialog');
var dialog_defer = q.defer();
var dialog_ref;
Modal.createDialog(SetDisplayNameDialog, {
currentDisplayName: result.displayname,
ref: (r) => {
dialog_ref = r;
},
onFinished: (submitted) => {
onFinished: (submitted, newDisplayName) => {
if (submitted) {
cli.setDisplayName(dialog_ref.getValue()).done(() => {
cli.setDisplayName(newDisplayName).done(() => {
dialog_defer.resolve();
});
}