From 971e9f89dac2e749df9bb273cdd7cfb74496b1ce Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Thu, 25 Feb 2016 14:50:10 -0500 Subject: Fix dismissing deleted root post that had comments on it --- web/react/stores/post_store.jsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/web/react/stores/post_store.jsx b/web/react/stores/post_store.jsx index 1dc0dc9bf..a6dfcd46f 100644 --- a/web/react/stores/post_store.jsx +++ b/web/react/stores/post_store.jsx @@ -303,6 +303,20 @@ class PostStoreClass extends EventEmitter { postList.order.splice(index, 1); } + for (const pid in postList.posts) { + if (!postList.posts.hasOwnProperty(pid)) { + continue; + } + + if (postList.posts[pid].root_id === post.id) { + Reflect.deleteProperty(postList.posts, pid); + const commentIndex = postList.order.indexOf(pid); + if (commentIndex !== -1) { + postList.order.splice(commentIndex, 1); + } + } + } + this.postsInfo[channelId].postList = postList; } -- cgit v1.2.3-1-g7c22