From 3796193291373a1f1293661b3b67a7050a9263f9 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Sat, 2 May 2015 08:44:52 +0930 Subject: [PATCH] Only add a post to the post stream once --- js/forum/src/utils/post-stream.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/js/forum/src/utils/post-stream.js b/js/forum/src/utils/post-stream.js index d31dacbe0..9299d1209 100644 --- a/js/forum/src/utils/post-stream.js +++ b/js/forum/src/utils/post-stream.js @@ -112,10 +112,13 @@ export default class PostStream { }) } + // @todo rename to pushPost addPostToEnd(post) { - var index = this.ids.length - this.ids.push(post.id()) - this.content.push(this.makeItem(index, index, post)) + if (this.ids.indexOf(post.id()) === -1) { + var index = this.ids.length; + this.ids.push(post.id()); + this.content.push(this.makeItem(index, index, post)); + } } removePost(id) {