From 26689d34b8fb13ba988b94538d8b5acf1fc2c411 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 11 Jun 2014 17:25:56 -0400 Subject: [PATCH] A little extra robustness for the post stream --- app/assets/javascripts/discourse/models/post_stream.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/models/post_stream.js b/app/assets/javascripts/discourse/models/post_stream.js index 9888d5d8f8e..0a38c5c8d12 100644 --- a/app/assets/javascripts/discourse/models/post_stream.js +++ b/app/assets/javascripts/discourse/models/post_stream.js @@ -470,7 +470,10 @@ Discourse.PostStream = Em.Object.extend({ @returns {Discourse.Post} the post that was inserted. **/ appendPost: function(post) { - this.get('posts').addObject(this.storePost(post)); + var stored = this.storePost(post); + if (stored) { + this.get('posts').addObject(stored); + } return post; }, @@ -683,7 +686,7 @@ Discourse.PostStream = Em.Object.extend({ @returns {Discourse.Post} the post from the identity map **/ storePost: function(post) { - var postId = post.get('id'); + var postId = Em.get(post, 'id'); if (postId) { var postIdentityMap = this.get('postIdentityMap'), existing = postIdentityMap.get(post.get('id'));