Replace all trivial Promise.defer usages with regular Promises

(cherry picked from commit 44401d73b4)
This commit is contained in:
Michael Telatynski 2019-11-12 11:40:38 +00:00
parent 548e38cba9
commit 217dfc3eed
5 changed files with 122 additions and 138 deletions

View file

@ -178,17 +178,12 @@ module.exports = createReactClass({
},
_optionallySetEmail: function() {
const deferred = Promise.defer();
// Ask for an email otherwise the user has no way to reset their password
const SetEmailDialog = sdk.getComponent("dialogs.SetEmailDialog");
Modal.createTrackedDialog('Do you want to set an email address?', '', SetEmailDialog, {
const modal = Modal.createTrackedDialog('Do you want to set an email address?', '', SetEmailDialog, {
title: _t('Do you want to set an email address?'),
onFinished: (confirmed) => {
// ignore confirmed, setting an email is optional
deferred.resolve(confirmed);
},
});
return deferred.promise;
return modal.finished.then(([confirmed]) => confirmed);
},
_onExportE2eKeysClicked: function() {