From 05af5d14b8d07b010c70750ae1ac5ddf22c120a7 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Tue, 13 Sep 2016 12:02:37 -0400 Subject: Highlight comment bar for comments considered mentions (#3938) --- webapp/components/post_view/components/post.jsx | 2 +- .../components/post_view/components/post_body.jsx | 14 ++++++-- .../post_view/components/post_header.jsx | 2 -- .../components/post_view/components/post_info.jsx | 8 +---- .../components/post_view/components/post_list.jsx | 39 +++++++++++----------- 5 files changed, 33 insertions(+), 32 deletions(-) (limited to 'webapp/components/post_view') diff --git a/webapp/components/post_view/components/post.jsx b/webapp/components/post_view/components/post.jsx index e9019bf38..7aa0c028e 100644 --- a/webapp/components/post_view/components/post.jsx +++ b/webapp/components/post_view/components/post.jsx @@ -236,7 +236,6 @@ export default class Post extends React.Component { post={post} sameRoot={this.props.sameRoot} commentCount={commentCount} - isCommentMention={this.props.isCommentMention} handleCommentClick={this.handleCommentClick} handleDropdownOpened={this.handleDropdownOpened} isLastComment={this.props.isLastComment} @@ -255,6 +254,7 @@ export default class Post extends React.Component { handleCommentClick={this.handleCommentClick} compactDisplay={this.props.compactDisplay} previewCollapsed={this.props.previewCollapsed} + isCommentMention={this.props.isCommentMention} /> diff --git a/webapp/components/post_view/components/post_body.jsx b/webapp/components/post_view/components/post_body.jsx index 8c3b3009f..3295f5bac 100644 --- a/webapp/components/post_view/components/post_body.jsx +++ b/webapp/components/post_view/components/post_body.jsx @@ -23,6 +23,10 @@ export default class PostBody extends React.Component { this.removePost = this.removePost.bind(this); } shouldComponentUpdate(nextProps) { + if (nextProps.isCommentMention !== this.props.isCommentMention) { + return true; + } + if (!Utils.areObjectsEqual(nextProps.post, this.props.post)) { return true; } @@ -190,10 +194,15 @@ export default class PostBody extends React.Component { ); } + let mentionHighlightClass = ''; + if (this.props.isCommentMention) { + mentionHighlightClass = 'mention-comment'; + } + return (
{comment} -
+
{messageWithAdditionalContent} {fileAttachmentHolder}
@@ -208,5 +217,6 @@ PostBody.propTypes = { retryPost: React.PropTypes.func.isRequired, handleCommentClick: React.PropTypes.func.isRequired, compactDisplay: React.PropTypes.bool, - previewCollapsed: React.PropTypes.string + previewCollapsed: React.PropTypes.string, + isCommentMention: React.PropTypes.bool }; diff --git a/webapp/components/post_view/components/post_header.jsx b/webapp/components/post_view/components/post_header.jsx index 27715e5f5..5900c8281 100644 --- a/webapp/components/post_view/components/post_header.jsx +++ b/webapp/components/post_view/components/post_header.jsx @@ -64,7 +64,6 @@ export default class PostHeader extends React.Component { this.props.lastViewed; + if (notCurrentUser && notViewed) { + if (commentsNotifyLevel === 'any' && (posts[commentRootId].user_id === userId || post.create_at > lastCommentOnThreadTime)) { + isCommentMention = true; + } else if (commentsNotifyLevel === 'root' && posts[commentRootId].user_id === userId) { + isCommentMention = true; + } } } -- cgit v1.2.3-1-g7c22