fixes mm-831 post timestamps now update
Этот коммит содержится в:
@@ -34,6 +34,10 @@ module.exports = React.createClass({
|
|||||||
results: null
|
results: null
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
forceUpdateInfo: function() {
|
||||||
|
this.refs.info.forceUpdate();
|
||||||
|
this.refs.header.forceUpdate();
|
||||||
|
},
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
return { };
|
return { };
|
||||||
},
|
},
|
||||||
@@ -80,9 +84,9 @@ module.exports = React.createClass({
|
|||||||
</div>
|
</div>
|
||||||
: null }
|
: null }
|
||||||
<div className="post__content">
|
<div className="post__content">
|
||||||
<PostHeader post={post} sameRoot={this.props.sameRoot} commentCount={commentCount} handleCommentClick={this.handleCommentClick} isLastComment={this.props.isLastComment} />
|
<PostHeader ref="header" 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} />
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ 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();
|
||||||
@@ -128,6 +129,7 @@ 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');
|
||||||
},
|
},
|
||||||
@@ -206,12 +208,8 @@ module.exports = React.createClass({
|
|||||||
var index = post_list.order.indexOf(msg.props.post_id);
|
var index = post_list.order.indexOf(msg.props.post_id);
|
||||||
if (index > -1) post_list.order.splice(index, 1);
|
if (index > -1) post_list.order.splice(index, 1);
|
||||||
|
|
||||||
var scrollSave = $(".post-list-holder-by-time").scrollTop();
|
|
||||||
|
|
||||||
this.setState({ post_list: post_list });
|
this.setState({ post_list: post_list });
|
||||||
|
|
||||||
$(".post-list-holder-by-time").scrollTop(scrollSave)
|
|
||||||
|
|
||||||
PostStore.storePosts(msg.channel_id, post_list);
|
PostStore.storePosts(msg.channel_id, post_list);
|
||||||
} else {
|
} else {
|
||||||
AsyncClient.getPosts(true, msg.channel_id);
|
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) {
|
if (activeRootPostId === msg.props.post_id && UserStore.getCurrentId() != msg.user_id) {
|
||||||
$('#post_deleted').modal('show');
|
$('#post_deleted').modal('show');
|
||||||
}
|
}
|
||||||
} else if(msg.action == "new_user") {
|
} else if (msg.action == "new_user") {
|
||||||
AsyncClient.getProfiles();
|
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) {
|
getMorePosts: function(e) {
|
||||||
e.preventDefault();
|
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
|
// 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 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);
|
currentPostDay = utils.getDateForUnixTicks(post.create_at);
|
||||||
if (currentPostDay.toDateString() != previousPostDay.toDateString()) {
|
if (currentPostDay.toDateString() != previousPostDay.toDateString()) {
|
||||||
|
|||||||
@@ -280,6 +280,7 @@ module.exports = React.createClass({
|
|||||||
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(){
|
||||||
@@ -292,6 +293,7 @@ module.exports = React.createClass({
|
|||||||
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()) {
|
||||||
@@ -302,7 +304,6 @@ module.exports = React.createClass({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
_onChangeAll: function() {
|
_onChangeAll: function() {
|
||||||
|
|
||||||
if (this.isMounted()) {
|
if (this.isMounted()) {
|
||||||
|
|
||||||
// if something was changed in the channel like adding a
|
// if something was changed in the channel like adding a
|
||||||
@@ -331,6 +332,12 @@ module.exports = React.createClass({
|
|||||||
this.setState(getStateFromStores());
|
this.setState(getStateFromStores());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
_onTimeChange: function() {
|
||||||
|
for (var id in this.state.post_list.posts) {
|
||||||
|
if (!this.refs[id]) continue;
|
||||||
|
this.refs[id].forceUpdate();
|
||||||
|
}
|
||||||
|
},
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
return getStateFromStores();
|
return getStateFromStores();
|
||||||
},
|
},
|
||||||
@@ -390,7 +397,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 key={cpost.id} post={cpost} selected={ (cpost.id == selected_post.id) } />
|
return <CommentPost ref={cpost.id} key={cpost.id} post={cpost} selected={ (cpost.id == selected_post.id) } />
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
<div className="post-create__container">
|
<div className="post-create__container">
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user