add counter for omitted replies and links in replies

This commit is contained in:
plebeius.eth
2024-04-02 12:23:18 +02:00
parent 8dca42e469
commit fa7564b559
5 changed files with 73 additions and 23 deletions
-19
View File
@@ -1,19 +0,0 @@
import { Comment } from '@plebbit/plebbit-react-hooks';
export const countLinksInCommentReplies = (comment: Comment) => {
let linkCount = 0;
if (comment.replyCount > 0) {
for (let reply of comment.replies.pages.topAll.comments) {
if (reply.link) {
linkCount++;
}
if (reply.replyCount > 0) {
linkCount += countLinksInCommentReplies(reply);
}
}
}
return linkCount;
};