diff options
author | Joram Wilander <jwawilander@gmail.com> | 2015-11-30 07:51:55 -0500 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2015-11-30 07:51:55 -0500 |
commit | f1629174a36cbfbf2594e850c8aef7f06ad9cc3e (patch) | |
tree | 0480681a68cb506616330900dc5365861b622e4d | |
parent | d4eb8743e3bd36b6cd2e7939c9a698d893b215d7 (diff) | |
parent | 0e84ab440e78830b5afe0a716228b8919ebb26bc (diff) | |
download | chat-f1629174a36cbfbf2594e850c8aef7f06ad9cc3e.tar.gz chat-f1629174a36cbfbf2594e850c8aef7f06ad9cc3e.tar.bz2 chat-f1629174a36cbfbf2594e850c8aef7f06ad9cc3e.zip |
Merge pull request #1533 from hmhealey/plt1290
PLT-1290 Fix up arrow to edit posts
-rw-r--r-- | web/react/stores/post_store.jsx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/web/react/stores/post_store.jsx b/web/react/stores/post_store.jsx index 24b0d0dd0..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); @@ -554,7 +566,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) { |