diff --git a/src/lib/app/i18n/en.json b/src/lib/app/i18n/en.json index e729332d..4bb17389 100644 --- a/src/lib/app/i18n/en.json +++ b/src/lib/app/i18n/en.json @@ -624,7 +624,9 @@ }, "locked": "This post is locked.", "banned": "You are banned from this community.", - "more": "{{comments:number}} more" + "more": "{{comments:number}} more", + "collapse": "Collapse", + "expand": "Expand" }, "moderation": { "report": "Report", diff --git a/src/lib/feature/comment/CommentTree.svelte b/src/lib/feature/comment/CommentTree.svelte index b8d37988..6f2c5808 100644 --- a/src/lib/feature/comment/CommentTree.svelte +++ b/src/lib/feature/comment/CommentTree.svelte @@ -48,33 +48,10 @@ return } - const tree = buildCommentsTree(newComments.comments, parent.depth) - - // 0.18.2 -> 0.18.3 broke this - // so i'm adding this check - const treeParent = tree.find( - (c) => c.comment_view.comment.id == parent.comment_view.comment.id, - ) - - if (treeParent) { - // < 0.18.3 - parent.children = treeParent.children - if (treeParent.children.length == 0) { - toast({ - content: $t('toast.noComments'), - type: 'warning', - }) - } - } else { - // 0.18.3+ - parent.children = tree - if (tree.length == 0) { - toast({ - content: $t('toast.noComments'), - type: 'warning', - }) - } - } + parent.children = buildCommentsTree( + newComments.comments, + parent.depth, + )[0].children childrenPage++ } catch (err) { console.error(err) @@ -95,10 +72,16 @@ node.comment_view.counts.child_count > 0) && 'border-l', 'ml-2.5 pl-3 sm:pl-4 lg:pl-5', - 'border-slate-200 dark:border-zinc-800', + 'comment-border', ]} bind:open={nodes[index].expanded} > + +
{#if node.children?.length > 0}