Added timestamp updates to right side and cleaned code
Этот коммит содержится в:
@@ -63,7 +63,7 @@ module.exports = React.createClass({
|
||||
oldScrollHeight: 0,
|
||||
oldZoom: 0,
|
||||
scrolledToNew: false,
|
||||
p: 0,
|
||||
preForcePosision: 0,
|
||||
wasForced: false,
|
||||
componentDidMount: function() {
|
||||
var user = UserStore.getCurrentUser();
|
||||
@@ -80,6 +80,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();
|
||||
@@ -110,8 +111,7 @@ module.exports = React.createClass({
|
||||
|
||||
$(post_holder).scroll(function(e){
|
||||
if (self.wasForced) {
|
||||
console.log('hit');
|
||||
$(post_holder).scrollTop(self.p);
|
||||
$(post_holder).scrollTop(self.preForcePosision);
|
||||
$(post_holder).perfectScrollbar('update');
|
||||
self.wasForced = false;
|
||||
}
|
||||
@@ -165,6 +165,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');
|
||||
},
|
||||
@@ -201,13 +202,7 @@ 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) {
|
||||
if (msg.action == "posted") {
|
||||
@@ -271,6 +266,11 @@ module.exports = React.createClass({
|
||||
AsyncClient.getProfiles();
|
||||
}
|
||||
},
|
||||
_onTimeChange: function() {
|
||||
this.wasForced = true;
|
||||
this.preForcePosision = $(".post-list-holder-by-time").scrollTop();
|
||||
this.forceUpdate()
|
||||
},
|
||||
getMorePosts: function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -461,7 +461,7 @@ module.exports = React.createClass({
|
||||
isLastComment = (i === 0 || posts[order[i-1]].root_id != post.root_id);
|
||||
}
|
||||
|
||||
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} />;
|
||||
var postCtl = <Post 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()) {
|
||||
|
||||
Ссылка в новой задаче
Block a user