From 10d4ec863e8fb61d9f80f4d516884d606178724a Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Mon, 26 Aug 2019 01:37:50 +0000 Subject: [PATCH] Snip deeply nested comments --- webclient/src/Article.js | 2 +- webclient/src/Comments.js | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/webclient/src/Article.js b/webclient/src/Article.js index 33c1647..ec48385 100644 --- a/webclient/src/Article.js +++ b/webclient/src/Article.js @@ -62,7 +62,7 @@ class Article extends React.Component { :

loading...

} - + } diff --git a/webclient/src/Comments.js b/webclient/src/Comments.js index 1d24daf..3910f28 100644 --- a/webclient/src/Comments.js +++ b/webclient/src/Comments.js @@ -33,16 +33,20 @@ class Article extends React.Component { ); } - displayComment(c, level) { + displayComment(story, c, level) { return (
-

{c.author || '[Deleted]'} | {moment.unix(c.date).fromNow()}

+

{c.author === story.author ? '[OP]' : ''} {c.author || '[Deleted]'} | {moment.unix(c.date).fromNow()}

- {c.comments.map(i => this.displayComment(i, level + 1))} + {level < 6 ? + c.comments.map(i => this.displayComment(story, i, level + 1)) + : +

[replies snipped]

+ }
); } @@ -69,7 +73,7 @@ class Article extends React.Component { {infoLine(story)}
- {story.comments.map(c => this.displayComment(c, 0))} + {story.comments.map(c => this.displayComment(story, c, 0))}
: