summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authornickago <ngonella@calpoly.edu>2015-07-13 07:23:28 -0700
committernickago <ngonella@calpoly.edu>2015-07-13 07:23:45 -0700
commitb63d42c2c6256ab5e904939a83d7e3eb530e101e (patch)
tree95a2df31e41aac20f90720608cf92d8cd0c64c67 /web
parent6cc8788193630b802375669c72fab02220cb692a (diff)
parentb26bc73c7880e691e77e9ca4169e9ed7735e3bc9 (diff)
downloadchat-b63d42c2c6256ab5e904939a83d7e3eb530e101e.tar.gz
chat-b63d42c2c6256ab5e904939a83d7e3eb530e101e.tar.bz2
chat-b63d42c2c6256ab5e904939a83d7e3eb530e101e.zip
merge conflicts
Diffstat (limited to 'web')
-rw-r--r--web/react/components/post.jsx2
-rw-r--r--web/react/components/post_list.jsx16
2 files changed, 16 insertions, 2 deletions
diff --git a/web/react/components/post.jsx b/web/react/components/post.jsx
index 04b5ba082..2d25e31e0 100644
--- a/web/react/components/post.jsx
+++ b/web/react/components/post.jsx
@@ -85,7 +85,7 @@ module.exports = React.createClass({
<div className="post__content">
<PostHeader post={post} sameRoot={this.props.sameRoot} commentCount={commentCount} handleCommentClick={this.handleCommentClick} isLastComment={this.props.isLastComment} />
<PostBody post={post} sameRoot={this.props.sameRoot} parentPost={parentPost} posts={posts} handleCommentClick={this.handleCommentClick} />
- <PostInfo post={post} sameRoot={this.props.sameRoot} commentCount={commentCount} handleCommentClick={this.handleCommentClick} allowReply="true" />
+ <PostInfo ref="info" post={post} sameRoot={this.props.sameRoot} commentCount={commentCount} handleCommentClick={this.handleCommentClick} allowReply="true" />
</div>
</div>
</div>
diff --git a/web/react/components/post_list.jsx b/web/react/components/post_list.jsx
index d6dc9ce30..59f33fb4d 100644
--- a/web/react/components/post_list.jsx
+++ b/web/react/components/post_list.jsx
@@ -63,6 +63,8 @@ module.exports = React.createClass({
oldScrollHeight: 0,
oldZoom: 0,
scrolledToNew: false,
+ p: 0,
+ wasForced: false,
componentDidMount: function() {
var user = UserStore.getCurrentUser();
if (user.props && user.props.theme) {
@@ -107,6 +109,12 @@ module.exports = React.createClass({
});
$(post_holder).scroll(function(e){
+ if (self.wasForced) {
+ console.log('hit');
+ $(post_holder).scrollTop(self.p);
+ $(post_holder).perfectScrollbar('update');
+ self.wasForced = false;
+ }
if (!self.preventScrollTrigger) {
self.scrollPosition = $(post_holder).scrollTop() + $(post_holder).innerHeight();
}
@@ -193,6 +201,12 @@ module.exports = React.createClass({
this.scrolledToNew = false;
}
this.setState(newState);
+ } else {
+ // Updates the timestamp on each post
+ this.wasForced = true;
+ this.p = $(".post-list-holder-by-time").scrollTop();
+ this.forceUpdate()
+ //this.refs.post0.refs.info.forceUpdate();
}
},
_onSocketChange: function(msg) {
@@ -447,7 +461,7 @@ module.exports = React.createClass({
isLastComment = (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"+(order.length-i-1)}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.getDate() !== previousPostDay.getDate() || currentPostDay.getMonth() !== previousPostDay.getMonth() || currentPostDay.getFullYear() !== previousPostDay.getFullYear()) {