mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-28 01:56:01 -05:00
A little extra robustness for the post stream
This commit is contained in:
parent
5e461a22ee
commit
26689d34b8
1 changed files with 5 additions and 2 deletions
|
@ -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'));
|
||||
|
|
Loading…
Reference in a new issue