diff options
author | JoramWilander <jwawilander@gmail.com> | 2015-08-12 12:45:15 -0400 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2015-08-18 08:59:26 -0400 |
commit | fa1491bbfbb1261757943759edf44883d31e5477 (patch) | |
tree | ac5474908c28abf741371602603e22669cb4197e /web/react/components/post_list.jsx | |
parent | c77f6041889b2dd8c6e830b8c2f42ab9c1340849 (diff) | |
download | chat-fa1491bbfbb1261757943759edf44883d31e5477.tar.gz chat-fa1491bbfbb1261757943759edf44883d31e5477.tar.bz2 chat-fa1491bbfbb1261757943759edf44883d31e5477.zip |
finalize implenetation of predictive client posts so that users get immediate feedback after posting
Diffstat (limited to 'web/react/components/post_list.jsx')
-rw-r--r-- | web/react/components/post_list.jsx | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/web/react/components/post_list.jsx b/web/react/components/post_list.jsx index 834d7b0ff..5f977972b 100644 --- a/web/react/components/post_list.jsx +++ b/web/react/components/post_list.jsx @@ -190,26 +190,13 @@ module.exports = React.createClass({ this.setState(newState); } }, - _onSocketChange: function(msg) { - if (msg.action == "posted") { - var post = JSON.parse(msg.props.post); - - if (post.pending_post_id !== "") { - PostStore.removePendingPost(post.channel_id, post.pending_post_id); - } - - post.pending_post_id = ""; - - postList.posts[post.id] = post; - if (postList.order.indexOf(post.id) === -1) { - postList.order.unshift(post.id); - } - - post_list.posts[post.id] = post; - if (post_list.order.indexOf(post.id) === -1) { - post_list.order.unshift(post.id); - } - + onSocketChange: function(msg) { + var postList; + var post; + if (msg.action === 'posted') { + post = JSON.parse(msg.props.post); + PostStore.storePost(post); + } else if (msg.action === 'post_edited') { if (this.state.channel.id === msg.channel_id) { this.setState({ post_list: post_list }); }; |