mirror of
https://github.com/discourse/discourse.git
synced 2025-02-22 00:03:26 +08:00
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:
parent
b92e4465f7
commit
492742837e
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user