From bc3ec84180f74fbb621318a066f68705021ab133 Mon Sep 17 00:00:00 2001 From: Benjamin Goering Date: Fri, 7 Apr 2017 12:25:33 -0700 Subject: [PATCH] IgnoredCommentTombstone renders for replies too --- client/coral-embed-stream/src/Comment.js | 50 +++++++++++-------- .../src/IgnoredCommentTombstone.js | 18 +++++++ client/coral-embed-stream/src/Stream.js | 18 ++----- 3 files changed, 49 insertions(+), 37 deletions(-) create mode 100644 client/coral-embed-stream/src/IgnoredCommentTombstone.js diff --git a/client/coral-embed-stream/src/Comment.js b/client/coral-embed-stream/src/Comment.js index b0f83a684..7f9f948ed 100644 --- a/client/coral-embed-stream/src/Comment.js +++ b/client/coral-embed-stream/src/Comment.js @@ -21,6 +21,7 @@ import LikeButton from 'coral-plugin-likes/LikeButton'; import {BestButton, IfUserCanModifyBest, BEST_TAG, commentIsBest, BestIndicator} from 'coral-plugin-best/BestButton'; import LoadMore from 'coral-embed-stream/src/LoadMore'; import {Slot} from 'coral-framework'; +import IgnoredCommentTombstone from './IgnoredCommentTombstone'; import styles from './Comment.css'; import classnames from 'classnames'; @@ -86,6 +87,9 @@ class Comment extends React.Component { }).isRequired }).isRequired, + // given a comment, return whether it should be rendered as ignored + commentIsIgnored: React.PropTypes.func, + // dispatch action to add a tag to a comment addCommentTag: React.PropTypes.func, @@ -118,6 +122,7 @@ class Comment extends React.Component { removeCommentTag, ignoreUser, disableReply, + commentIsIgnored, } = this.props; const like = getActionSummary('LikeActionSummary', comment); @@ -348,28 +353,29 @@ class Comment extends React.Component { { comment.replies && comment.replies.map(reply => { - return ; + return commentIsIgnored(reply) + ? + : ; }) } { diff --git a/client/coral-embed-stream/src/IgnoredCommentTombstone.js b/client/coral-embed-stream/src/IgnoredCommentTombstone.js new file mode 100644 index 000000000..aca235a02 --- /dev/null +++ b/client/coral-embed-stream/src/IgnoredCommentTombstone.js @@ -0,0 +1,18 @@ +import React from 'react'; + +// Render in place of a Comment when the author of the comment is ignored +const IgnoredCommentTombstone = () => ( +
+
+

+ This comment is hidden because you ignored this user. +

+
+); + +export default IgnoredCommentTombstone; diff --git a/client/coral-embed-stream/src/Stream.js b/client/coral-embed-stream/src/Stream.js index 4758af1c0..f91e496e8 100644 --- a/client/coral-embed-stream/src/Stream.js +++ b/client/coral-embed-stream/src/Stream.js @@ -1,5 +1,6 @@ import React, {PropTypes} from 'react'; import Comment from './Comment'; +import IgnoredCommentTombstone from './IgnoredCommentTombstone'; class Stream extends React.Component { @@ -75,7 +76,8 @@ class Stream extends React.Component { postDontAgree={postDontAgree} addCommentTag={addCommentTag} removeCommentTag={removeCommentTag} - ignoreUser ={ignoreUser} + ignoreUser={ignoreUser} + commentIsIgnored={commentIsIgnored} loadMore={loadMore} deleteAction={deleteAction} showSignInDialog={showSignInDialog} @@ -91,18 +93,4 @@ class Stream extends React.Component { } } -const IgnoredCommentTombstone = () => ( -
-
-

- This comment is hidden because you ignored this user. -

-
-); - export default Stream;