diff options
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 }); }; |