From e9f0ef83b01d30993ee0db9a21f6e835ebc1783f Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Sat, 2 May 2015 08:44:42 +0930 Subject: [PATCH] Remove posts from the post stream by ID --- js/forum/src/components/stream-content.js | 2 +- js/forum/src/utils/post-stream.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/forum/src/components/stream-content.js b/js/forum/src/components/stream-content.js index 6acd5bf10..16c6a60d3 100644 --- a/js/forum/src/components/stream-content.js +++ b/js/forum/src/components/stream-content.js @@ -57,7 +57,7 @@ export default class StreamContent extends mixin(Component, evented) { } ondelete(post) { - this.props.stream.removePost(post); + this.props.stream.removePost(post.id()); } /** diff --git a/js/forum/src/utils/post-stream.js b/js/forum/src/utils/post-stream.js index 903b3b544..d31dacbe0 100644 --- a/js/forum/src/utils/post-stream.js +++ b/js/forum/src/utils/post-stream.js @@ -118,10 +118,10 @@ export default class PostStream { this.content.push(this.makeItem(index, index, post)) } - removePost(post) { - this.ids.splice(this.ids.indexOf(post.id()), 1); + removePost(id) { + this.ids.splice(this.ids.indexOf(id), 1); this.content.some((item, i) => { - if (item.post === post) { + if (item.post && item.post.id() === id) { this.content.splice(i, 1); return true; }