diff options
author | enahum <nahumhbl@gmail.com> | 2016-06-09 15:28:57 -0300 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2016-06-09 11:28:57 -0700 |
commit | 18c53e03ebaf1021c5b8429ef7bce09e5de0c4a6 (patch) | |
tree | ccaa7bd967f50d005e517401abcfc59536fa18c9 /webapp/stores/post_store.jsx | |
parent | f1eefd99e6e40621ace005afcb1c08c6a69a744e (diff) | |
download | chat-18c53e03ebaf1021c5b8429ef7bce09e5de0c4a6.tar.gz chat-18c53e03ebaf1021c5b8429ef7bce09e5de0c4a6.tar.bz2 chat-18c53e03ebaf1021c5b8429ef7bce09e5de0c4a6.zip |
PLT-3221 Remove async call to get posts when creating a comment and editing a post (#3300)
PLT-3203 Commenting on the RHS while in permalink view makes the message not show up in the RHS
Diffstat (limited to 'webapp/stores/post_store.jsx')
-rw-r--r-- | webapp/stores/post_store.jsx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/webapp/stores/post_store.jsx b/webapp/stores/post_store.jsx index 062997f2b..73cb60314 100644 --- a/webapp/stores/post_store.jsx +++ b/webapp/stores/post_store.jsx @@ -231,13 +231,14 @@ class PostStoreClass extends EventEmitter { this.postsInfo[post.channel_id].postList = postList; } - storeFocusedPost(postId, postList) { + storeFocusedPost(postId, channelId, postList) { const focusedPost = postList.posts[postId]; if (!focusedPost) { return; } this.currentFocusedPostId = postId; this.storePosts(postId, postList); + this.storePosts(channelId, postList); } checkBounds(id, numRequested, postList, before) { @@ -407,11 +408,11 @@ class PostStoreClass extends EventEmitter { return null; } - let posts; + const posts = {}; let pendingPosts; for (const k in this.postsInfo) { if (this.postsInfo[k].postList && this.postsInfo[k].postList.posts.hasOwnProperty(this.selectedPostId)) { - posts = this.postsInfo[k].postList.posts; + Object.assign(posts, this.postsInfo[k].postList.posts); if (this.postsInfo[k].pendingPosts != null) { pendingPosts = this.postsInfo[k].pendingPosts.posts; } @@ -559,7 +560,7 @@ PostStore.dispatchToken = AppDispatcher.register((payload) => { } case ActionTypes.RECEIVED_FOCUSED_POST: PostStore.clearChannelVisibility(action.postId, false); - PostStore.storeFocusedPost(action.postId, makePostListNonNull(action.post_list)); + PostStore.storeFocusedPost(action.postId, action.channelId, makePostListNonNull(action.post_list)); PostStore.emitChange(); break; case ActionTypes.RECEIVED_POST: @@ -579,6 +580,10 @@ PostStore.dispatchToken = AppDispatcher.register((payload) => { PostStore.storeDraft(action.post.channel_id, null); PostStore.jumpPostsViewToBottom(); break; + case ActionTypes.CREATE_COMMENT: + PostStore.storePendingPost(action.post); + PostStore.storeCommentDraft(action.post.root_id, null); + break; case ActionTypes.POST_DELETED: PostStore.deletePost(action.post); PostStore.emitChange(); |