commit post not working properly when stage post was not called
caused issues editing posts that were committed by the composer
This commit is contained in:
parent
705e7105c8
commit
1d021d7019
|
@ -326,20 +326,20 @@ const PostStream = Ember.Object.extend({
|
||||||
|
|
||||||
// Commit the post we staged. Call this after a save succeeds.
|
// Commit the post we staged. Call this after a save succeeds.
|
||||||
commitPost(post) {
|
commitPost(post) {
|
||||||
if (this.get('loadedAllPosts')) {
|
|
||||||
this.appendPost(post);
|
// cleanup
|
||||||
}
|
if (this.get('topic.id') === post.get('topic_id')) {
|
||||||
// Correct for a dangling deleted post, if needed
|
if (this.get('loadedAllPosts')) {
|
||||||
// compensating for message bus pumping in new posts while
|
this.appendPost(post);
|
||||||
// your post is in transit
|
} else {
|
||||||
if(this.get('topic.highest_post_number') < post.get('post_number')){
|
// I guess we might as well keep the data
|
||||||
this.set('topic.highest_post_number', post.get('post_number'));
|
this.storePost(post);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.get('stream').removeObject(-1);
|
this.get('stream').removeObject(-1);
|
||||||
this.get('postIdentityMap').set(-1, null);
|
this.get('postIdentityMap').set(-1, null);
|
||||||
this.get('postIdentityMap').set(post.get('id'), post);
|
|
||||||
|
|
||||||
this.get('stream').addObject(post.get('id'));
|
|
||||||
this.set('stagingPost', false);
|
this.set('stagingPost', false);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue