diff options
author | Joram Wilander <jwawilander@gmail.com> | 2015-07-20 11:53:30 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2015-07-20 11:53:30 -0400 |
commit | 1c06c3fa091fee38978c76521120de196b7d74a8 (patch) | |
tree | 4f3dab888009c9ef15b63fb5fbf8431c66cf463a /web/react/components/post_list.jsx | |
parent | a1876cf6cc827743d8687a9113b727ef7190f452 (diff) | |
parent | 5e27bb3e618d94075e4fb198a937e24338bb0612 (diff) | |
download | chat-1c06c3fa091fee38978c76521120de196b7d74a8.tar.gz chat-1c06c3fa091fee38978c76521120de196b7d74a8.tar.bz2 chat-1c06c3fa091fee38978c76521120de196b7d74a8.zip |
Merge pull request #209 from mattermost/mm-831
fixes mm-831 post timestamps now update
Diffstat (limited to 'web/react/components/post_list.jsx')
-rw-r--r-- | web/react/components/post_list.jsx | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/web/react/components/post_list.jsx b/web/react/components/post_list.jsx index 5439ca43d..c058455ba 100644 --- a/web/react/components/post_list.jsx +++ b/web/react/components/post_list.jsx @@ -49,6 +49,7 @@ module.exports = React.createClass({ PostStore.addChangeListener(this._onChange); ChannelStore.addChangeListener(this._onChange); + UserStore.addStatusesChangeListener(this._onTimeChange); SocketStore.addChangeListener(this._onSocketChange); $(".post-list-holder-by-time").perfectScrollbar(); @@ -128,6 +129,7 @@ module.exports = React.createClass({ componentWillUnmount: function() { PostStore.removeChangeListener(this._onChange); ChannelStore.removeChangeListener(this._onChange); + UserStore.removeStatusesChangeListener(this._onTimeChange); SocketStore.removeChangeListener(this._onSocketChange); $('body').off('click.userpopover'); }, @@ -206,12 +208,8 @@ module.exports = React.createClass({ var index = post_list.order.indexOf(msg.props.post_id); if (index > -1) post_list.order.splice(index, 1); - var scrollSave = $(".post-list-holder-by-time").scrollTop(); - this.setState({ post_list: post_list }); - $(".post-list-holder-by-time").scrollTop(scrollSave) - PostStore.storePosts(msg.channel_id, post_list); } else { AsyncClient.getPosts(true, msg.channel_id); @@ -220,10 +218,16 @@ module.exports = React.createClass({ if (activeRootPostId === msg.props.post_id && UserStore.getCurrentId() != msg.user_id) { $('#post_deleted').modal('show'); } - } else if(msg.action == "new_user") { + } else if (msg.action == "new_user") { AsyncClient.getProfiles(); } }, + _onTimeChange: function() { + for (var id in this.state.post_list.posts) { + if (!this.refs[id]) continue; + this.refs[id].forceUpdateInfo(); + } + }, getMorePosts: function(e) { e.preventDefault(); @@ -415,7 +419,7 @@ module.exports = React.createClass({ // it is the last comment if it is last post in the channel or the next post has a different root post var isLastComment = utils.isComment(post) && (i === 0 || posts[order[i-1]].root_id != post.root_id); - var postCtl = <Post sameUser={sameUser} sameRoot={sameRoot} post={post} parentPost={parentPost} key={post.id} posts={posts} hideProfilePic={hideProfilePic} isLastComment={isLastComment} />; + var postCtl = <Post ref={post.id} sameUser={sameUser} sameRoot={sameRoot} post={post} parentPost={parentPost} key={post.id} posts={posts} hideProfilePic={hideProfilePic} isLastComment={isLastComment} />; currentPostDay = utils.getDateForUnixTicks(post.create_at); if (currentPostDay.toDateString() != previousPostDay.toDateString()) { |