From 4bc5ba9e50e9ee50b28e2cb0bd5996c578b1d851 Mon Sep 17 00:00:00 2001 From: hmhealey Date: Fri, 27 Nov 2015 17:03:09 -0500 Subject: Fixed getCommentCount --- web/react/stores/post_store.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web/react') diff --git a/web/react/stores/post_store.jsx b/web/react/stores/post_store.jsx index 24b0d0dd0..1525e4048 100644 --- a/web/react/stores/post_store.jsx +++ b/web/react/stores/post_store.jsx @@ -554,7 +554,7 @@ class PostStoreClass extends EventEmitter { return 0; } getCommentCount(post) { - const posts = this.getPosts(post.channel_id).posts; + const posts = this.getAllPosts(post.channel_id).posts; let commentCount = 0; for (const id in posts) { -- cgit v1.2.3-1-g7c22 From 0e84ab440e78830b5afe0a716228b8919ebb26bc Mon Sep 17 00:00:00 2001 From: hmhealey Date: Fri, 27 Nov 2015 17:03:29 -0500 Subject: Re-added PostStore.getPost --- web/react/stores/post_store.jsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'web/react') diff --git a/web/react/stores/post_store.jsx b/web/react/stores/post_store.jsx index 1525e4048..a8f0f9c63 100644 --- a/web/react/stores/post_store.jsx +++ b/web/react/stores/post_store.jsx @@ -39,6 +39,7 @@ class PostStoreClass extends EventEmitter { this.makePostsInfo = this.makePostsInfo.bind(this); + this.getPost = this.getPost.bind(this); this.getAllPosts = this.getAllPosts.bind(this); this.getEarliestPost = this.getEarliestPost.bind(this); this.getLatestPost = this.getLatestPost.bind(this); @@ -160,6 +161,17 @@ class PostStoreClass extends EventEmitter { } } + getPost(channelId, postId) { + const posts = this.postsInfo[channelId].postList; + let post = null; + + if (posts.posts.hasOwnProperty(postId)) { + post = Object.assign({}, posts.posts[postId]); + } + + return post; + } + getAllPosts(id) { if (this.postsInfo.hasOwnProperty(id)) { return Object.assign({}, this.postsInfo[id].postList); -- cgit v1.2.3-1-g7c22