fix: close #279, deleted/removed posts are still shown
This commit is contained in:
1 parent
c7e3f4d56e
commit
df0cfbd932
5 files changed
+23
-7
No files matched your search
@@ -24,7 +24,8 @@ function getDepthFromComment(comment?: Comment): number | undefined {
|
||||
|
||||
export function buildCommentsTree(
|
||||
comments: CommentView[],
|
||||
baseDepth: number = 0
|
||||
baseDepth: number = 0,
|
||||
filter: (c: CommentView) => boolean = (c) => true
|
||||
): CommentNodeI[] {
|
||||
const map = new Map<number, CommentNodeI>()
|
||||
|
||||
@@ -38,7 +39,9 @@ export function buildCommentsTree(
|
||||
depth: depth,
|
||||
}
|
||||
min_depth = Math.min(min_depth, depth)
|
||||
map.set(comment_view.comment.id, { ...node })
|
||||
if (filter(comment_view)) {
|
||||
map.set(comment_view.comment.id, { ...node })
|
||||
}
|
||||
}
|
||||
|
||||
const tree: CommentNodeI[] = []
|
||||
|
||||
Reference in new issue
Block a user