summaryrefslogtreecommitdiffstats
path: root/web/react/stores/post_store.jsx
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2016-02-25 14:50:10 -0500
committerJoramWilander <jwawilander@gmail.com>2016-02-25 14:50:10 -0500
commit971e9f89dac2e749df9bb273cdd7cfb74496b1ce (patch)
tree21139d93513fb6a9eae070c910f41a8894cdcbc0 /web/react/stores/post_store.jsx
parent04f6b0b86cf43ffedd96c59dcce4972831507ce9 (diff)
downloadchat-971e9f89dac2e749df9bb273cdd7cfb74496b1ce.tar.gz
chat-971e9f89dac2e749df9bb273cdd7cfb74496b1ce.tar.bz2
chat-971e9f89dac2e749df9bb273cdd7cfb74496b1ce.zip
Fix dismissing deleted root post that had comments on it
Diffstat (limited to 'web/react/stores/post_store.jsx')
-rw-r--r--web/react/stores/post_store.jsx14
1 files changed, 14 insertions, 0 deletions
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;
}