PERF: stop destroying drafts on client when posting replies

The server already ensures it advances draft keys when a post is created
this means this code that used to delete drafts is simply introducing
composer delays with no benefit.
This commit is contained in:
Sam Saffron 2019-10-29 17:07:33 +11:00
parent b92e4465f7
commit 492742837e

View File

@ -687,16 +687,6 @@ export default Controller.extend({
});
}
// If user "created a new topic/post" or "replied as a new topic" successfully, remove the draft.
let destroyDraftPromise;
if (result.responseJson.action === "create_post") {
destroyDraftPromise = this.destroyDraft();
} else {
destroyDraftPromise = Ember.RSVP.Promise.resolve();
}
return destroyDraftPromise.then(() => {
if (this.get("model.editingPost")) {
this.appEvents.trigger("post-stream:refresh", {
id: parseInt(result.responseJson.id)
@ -709,10 +699,7 @@ export default Controller.extend({
}
if (result.responseJson.action === "create_post") {
this.appEvents.trigger(
"post:highlight",
result.payload.post_number
);
this.appEvents.trigger("post:highlight", result.payload.post_number);
}
this.close();
@ -727,7 +714,6 @@ export default Controller.extend({
if (post && !staged) {
DiscourseURL.routeTo(post.url);
}
});
})
.catch(error => {
composer.set("disableDrafts", false);