FIX: opening cancel draft dialog broke autosave

cancelComposer would leak a promise that never got resolved if
you aborted cancelling a composer.

This change ensured the promise will always be resolved
This commit is contained in:
Sam Saffron 2020-05-27 18:16:48 +10:00
parent 63b3155983
commit f41fcad6c3
No known key found for this signature in database
GPG Key ID: B9606168D2FFD9F5
1 changed files with 19 additions and 11 deletions

View File

@ -1043,8 +1043,8 @@ export default Controller.extend({
if (differentDraft) {
this.model.clearState();
this.close();
resolve();
}
resolve();
}
},
{
@ -1052,22 +1052,30 @@ export default Controller.extend({
class: "btn-danger",
callback: result => {
if (result) {
this.destroyDraft().then(() => {
this.model.clearState();
this.close();
resolve();
});
this.destroyDraft()
.then(() => {
this.model.clearState();
this.close();
})
.finally(() => {
resolve();
});
} else {
resolve();
}
}
}
]);
} else {
// it is possible there is some sort of crazy draft with no body ... just give up on it
this.destroyDraft().then(() => {
this.model.clearState();
this.close();
resolve();
});
this.destroyDraft()
.then(() => {
this.model.clearState();
this.close();
})
.finally(() => {
resolve();
});
}
});