summaryrefslogtreecommitdiffstats
path: root/web/react/components/post_list.jsx
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2015-07-22 10:45:57 -0800
committerCorey Hulen <corey@hulen.com>2015-07-22 10:45:57 -0800
commitbeffcc0a3cafc700fdce98e794396cab371638c2 (patch)
tree85b2d11e3365c8619975048772c965fc33832790 /web/react/components/post_list.jsx
parent62d7c926519247e17dfe980172ec3f9ef7671274 (diff)
parent0967a131a152e056c1cb971f895b2d1f8df4d0ed (diff)
downloadchat-beffcc0a3cafc700fdce98e794396cab371638c2.tar.gz
chat-beffcc0a3cafc700fdce98e794396cab371638c2.tar.bz2
chat-beffcc0a3cafc700fdce98e794396cab371638c2.zip
Merge pull request #201 from hmhealey/mm1539
MM-1539 Added the ability to reply to earlier message threads by starting a post with ^
Diffstat (limited to 'web/react/components/post_list.jsx')
-rw-r--r--web/react/components/post_list.jsx17
1 files changed, 15 insertions, 2 deletions
diff --git a/web/react/components/post_list.jsx b/web/react/components/post_list.jsx
index 7c5d36593..8dc5013ca 100644
--- a/web/react/components/post_list.jsx
+++ b/web/react/components/post_list.jsx
@@ -22,7 +22,8 @@ function getStateFromStores() {
return {
post_list: PostStore.getCurrentPosts(),
- channel: channel
+ channel: channel,
+ activeThreadRootId: ""
};
}
@@ -51,6 +52,7 @@ module.exports = React.createClass({
ChannelStore.addChangeListener(this._onChange);
UserStore.addStatusesChangeListener(this._onTimeChange);
SocketStore.addChangeListener(this._onSocketChange);
+ PostStore.addActiveThreadChangedListener(this._onActiveThreadChanged);
$(".post-list-holder-by-time").perfectScrollbar();
@@ -131,6 +133,7 @@ module.exports = React.createClass({
ChannelStore.removeChangeListener(this._onChange);
UserStore.removeStatusesChangeListener(this._onTimeChange);
SocketStore.removeChangeListener(this._onSocketChange);
+ PostStore.removeActiveThreadChangedListener(this._onActiveThreadChanged);
$('body').off('click.userpopover');
},
resize: function() {
@@ -229,6 +232,9 @@ module.exports = React.createClass({
this.refs[id].forceUpdateInfo();
}
},
+ _onActiveThreadChanged: function(rootId, parentId) {
+ this.setState({"activeThreadRootId": rootId});
+ },
getMorePosts: function(e) {
e.preventDefault();
@@ -420,7 +426,14 @@ 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
var isLastComment = utils.isComment(post) && (i === 0 || posts[order[i-1]].root_id != post.root_id);
- var postCtl = <Post ref={post.id} sameUser={sameUser} sameRoot={sameRoot} post={post} parentPost={parentPost} key={post.id} posts={posts} hideProfilePic={hideProfilePic} isLastComment={isLastComment} />;
+ // check if this is part of the thread that we're currently replying to
+ var isActiveThread = this.state.activeThreadRootId && (post.id === this.state.activeThreadRootId || post.root_id === this.state.activeThreadRootId);
+
+ var postCtl = (
+ <Post ref={post.id} sameUser={sameUser} sameRoot={sameRoot} post={post} parentPost={parentPost} key={post.id}
+ posts={posts} hideProfilePic={hideProfilePic} isLastComment={isLastComment} isActiveThread={isActiveThread}
+ />
+ );
currentPostDay = utils.getDateForUnixTicks(post.create_at);
if (currentPostDay.toDateString() != previousPostDay.toDateString()) {