Merge pull request #182 from mattermost/revert-174-MM-831-3

Revert "MM-831 Time change ping riding on the status interupt for tim…
Этот коммит содержится в:
Joram Wilander
2015-07-14 12:07:27 -04:00
родитель 1f1ad8234a d9afa47ef8
Коммит a45dea6b06
2 изменённых файлов: 3 добавлений и 31 удалений

Просмотреть файл

@@ -35,8 +35,6 @@ module.exports = React.createClass({
oldScrollHeight: 0, oldScrollHeight: 0,
oldZoom: 0, oldZoom: 0,
scrolledToNew: false, scrolledToNew: false,
preForcePosision: 0,
wasForced: false,
componentDidMount: function() { componentDidMount: function() {
var user = UserStore.getCurrentUser(); var user = UserStore.getCurrentUser();
if (user.props && user.props.theme) { if (user.props && user.props.theme) {
@@ -52,7 +50,6 @@ module.exports = React.createClass({
PostStore.addChangeListener(this._onChange); PostStore.addChangeListener(this._onChange);
ChannelStore.addChangeListener(this._onChange); ChannelStore.addChangeListener(this._onChange);
UserStore.addStatusesChangeListener(this._onTimeChange);
SocketStore.addChangeListener(this._onSocketChange); SocketStore.addChangeListener(this._onSocketChange);
$(".post-list-holder-by-time").perfectScrollbar(); $(".post-list-holder-by-time").perfectScrollbar();
@@ -82,11 +79,6 @@ module.exports = React.createClass({
}); });
$(post_holder).scroll(function(e){ $(post_holder).scroll(function(e){
if (self.wasForced) {
$(post_holder).scrollTop(self.preForcePosision);
$(post_holder).perfectScrollbar('update');
self.wasForced = false;
}
if (!self.preventScrollTrigger) { if (!self.preventScrollTrigger) {
self.scrollPosition = $(post_holder).scrollTop() + $(post_holder).innerHeight(); self.scrollPosition = $(post_holder).scrollTop() + $(post_holder).innerHeight();
} }
@@ -137,7 +129,6 @@ module.exports = React.createClass({
componentWillUnmount: function() { componentWillUnmount: function() {
PostStore.removeChangeListener(this._onChange); PostStore.removeChangeListener(this._onChange);
ChannelStore.removeChangeListener(this._onChange); ChannelStore.removeChangeListener(this._onChange);
UserStore.removeStatusesChangeListener(this._onTimeChange);
SocketStore.removeChangeListener(this._onSocketChange); SocketStore.removeChangeListener(this._onSocketChange);
$('body').off('click.userpopover'); $('body').off('click.userpopover');
}, },
@@ -170,7 +161,7 @@ module.exports = React.createClass({
this.scrolledToNew = false; this.scrolledToNew = false;
} }
this.setState(newState); this.setState(newState);
} }
}, },
_onSocketChange: function(msg) { _onSocketChange: function(msg) {
if (msg.action == "posted") { if (msg.action == "posted") {
@@ -234,11 +225,6 @@ module.exports = React.createClass({
AsyncClient.getProfiles(); AsyncClient.getProfiles();
} }
}, },
_onTimeChange: function() {
this.wasForced = true;
this.preForcePosision = $(".post-list-holder-by-time").scrollTop();
this.forceUpdate();
},
getMorePosts: function(e) { getMorePosts: function(e) {
e.preventDefault(); e.preventDefault();

Просмотреть файл

@@ -281,11 +281,9 @@ function getStateFromStores() {
} }
module.exports = React.createClass({ module.exports = React.createClass({
wasForced: false,
componentDidMount: function() { componentDidMount: function() {
PostStore.addSelectedPostChangeListener(this._onChange); PostStore.addSelectedPostChangeListener(this._onChange);
PostStore.addChangeListener(this._onChangeAll); PostStore.addChangeListener(this._onChangeAll);
UserStore.addStatusesChangeListener(this._onTimeChange);
this.resize(); this.resize();
var self = this; var self = this;
$(window).resize(function(){ $(window).resize(function(){
@@ -293,15 +291,11 @@ module.exports = React.createClass({
}); });
}, },
componentDidUpdate: function() { componentDidUpdate: function() {
if(!this.wasForced){ this.resize();
this.resize();
this.wasForced = false;
}
}, },
componentWillUnmount: function() { componentWillUnmount: function() {
PostStore.removeSelectedPostChangeListener(this._onChange); PostStore.removeSelectedPostChangeListener(this._onChange);
PostStore.removeChangeListener(this._onChangeAll); PostStore.removeChangeListener(this._onChangeAll);
UserStore.removeStatusesChangeListener(this._onTimeChange);
}, },
_onChange: function() { _onChange: function() {
if (this.isMounted()) { if (this.isMounted()) {
@@ -341,14 +335,6 @@ module.exports = React.createClass({
this.setState(getStateFromStores()); this.setState(getStateFromStores());
} }
}, },
_onTimeChange: function() {
this.wasForced = true;
for (var key in this.refs) {
if(this.refs[key].forceUpdate != undefined) {
this.refs[key].forceUpdate();
}
}
},
getInitialState: function() { getInitialState: function() {
return getStateFromStores(); return getStateFromStores();
}, },
@@ -408,7 +394,7 @@ module.exports = React.createClass({
<RootPost post={root_post} commentCount={posts_array.length}/> <RootPost post={root_post} commentCount={posts_array.length}/>
<div className="post-right-comments-container"> <div className="post-right-comments-container">
{ posts_array.map(function(cpost) { { posts_array.map(function(cpost) {
return <CommentPost ref={cpost.id} key={cpost.id} post={cpost} selected={ (cpost.id == selected_post.id) } /> return <CommentPost key={cpost.id} post={cpost} selected={ (cpost.id == selected_post.id) } />
})} })}
</div> </div>
<div className="post-create__container"> <div className="post-create__container">