From 91bc7eaa5394ef441f33a71b1bf3dab23c274b93 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Fri, 28 Jul 2017 20:10:03 +0700 Subject: [PATCH] Make condition more clear --- client/coral-embed-stream/src/components/Stream.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/client/coral-embed-stream/src/components/Stream.js b/client/coral-embed-stream/src/components/Stream.js index b39ef3bd0..66ffc0fc8 100644 --- a/client/coral-embed-stream/src/components/Stream.js +++ b/client/coral-embed-stream/src/components/Stream.js @@ -104,12 +104,14 @@ class Stream extends React.Component { // even though the permalinked comment is the highlighted one, we're displaying its parent + replies let highlightedComment = comment && getTopLevelParent(comment); + if (highlightedComment) { + const isInactive = ['NONE', 'ACCEPTED'].indexOf(comment.status) === -1; + if (comment.parent && isInactive) { - if (highlightedComment && comment.parent && ['NONE', 'ACCEPTED'].indexOf(comment.status) === -1) { - - // the highlighted comment is not active and as such not in the replies, so we - // attach it to the right parent. - highlightedComment = attachCommentToParent(highlightedComment, comment); + // the highlighted comment is not active and as such not in the replies, so we + // attach it to the right parent. + highlightedComment = attachCommentToParent(highlightedComment, comment); + } } const banned = user && user.status === 'BANNED';