mirror of
https://github.com/discourse/discourse.git
synced 2025-04-29 10:04:33 +08:00
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:
parent
63b3155983
commit
f41fcad6c3
@ -1043,8 +1043,8 @@ export default Controller.extend({
|
|||||||
if (differentDraft) {
|
if (differentDraft) {
|
||||||
this.model.clearState();
|
this.model.clearState();
|
||||||
this.close();
|
this.close();
|
||||||
resolve();
|
|
||||||
}
|
}
|
||||||
|
resolve();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1052,22 +1052,30 @@ export default Controller.extend({
|
|||||||
class: "btn-danger",
|
class: "btn-danger",
|
||||||
callback: result => {
|
callback: result => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.destroyDraft().then(() => {
|
this.destroyDraft()
|
||||||
this.model.clearState();
|
.then(() => {
|
||||||
this.close();
|
this.model.clearState();
|
||||||
resolve();
|
this.close();
|
||||||
});
|
})
|
||||||
|
.finally(() => {
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
resolve();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
// it is possible there is some sort of crazy draft with no body ... just give up on it
|
// it is possible there is some sort of crazy draft with no body ... just give up on it
|
||||||
this.destroyDraft().then(() => {
|
this.destroyDraft()
|
||||||
this.model.clearState();
|
.then(() => {
|
||||||
this.close();
|
this.model.clearState();
|
||||||
resolve();
|
this.close();
|
||||||
});
|
})
|
||||||
|
.finally(() => {
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user