FIX: Make sure we decrease post count if new post fails to save.

This commit is contained in:
Guo Xiang Tan 2016-11-10 11:02:11 +08:00
parent 55865024c7
commit 531d649a75

View File

@ -686,6 +686,10 @@ const Composer = RestModel.extend({
}).catch(throwAjaxError(function() { }).catch(throwAjaxError(function() {
if (postStream) { if (postStream) {
postStream.undoPost(createdPost); postStream.undoPost(createdPost);
if (post) {
post.set('reply_count', post.get('reply_count') - 1);
}
} }
Ember.run.next(() => composer.set('composeState', OPEN)); Ember.run.next(() => composer.set('composeState', OPEN));
})); }));