Revert "MM-831 Time change ping riding on the status interupt for timestamp update"

Этот коммит содержится в:
Joram Wilander
2015-07-14 08:07:01 -04:00
родитель 1f1ad8234a
Коммит d9afa47ef8
2 изменённых файлов: 3 добавлений и 31 удалений

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

@@ -281,11 +281,9 @@ function getStateFromStores() {
}
module.exports = React.createClass({
wasForced: false,
componentDidMount: function() {
PostStore.addSelectedPostChangeListener(this._onChange);
PostStore.addChangeListener(this._onChangeAll);
UserStore.addStatusesChangeListener(this._onTimeChange);
this.resize();
var self = this;
$(window).resize(function(){
@@ -293,15 +291,11 @@ module.exports = React.createClass({
});
},
componentDidUpdate: function() {
if(!this.wasForced){
this.resize();
this.wasForced = false;
}
this.resize();
},
componentWillUnmount: function() {
PostStore.removeSelectedPostChangeListener(this._onChange);
PostStore.removeChangeListener(this._onChangeAll);
UserStore.removeStatusesChangeListener(this._onTimeChange);
},
_onChange: function() {
if (this.isMounted()) {
@@ -341,14 +335,6 @@ module.exports = React.createClass({
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() {
return getStateFromStores();
},
@@ -408,7 +394,7 @@ module.exports = React.createClass({
<RootPost post={root_post} commentCount={posts_array.length}/>
<div className="post-right-comments-container">
{ 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 className="post-create__container">