Skip to content

Commit c1675e4

Browse files
committed
cleanup: better naming to indicate the total number of comments including nested comments
1 parent 49a0a61 commit c1675e4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

components/show-new-comments.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ function prepareComments (client, newComments) {
2424
}).filter(Boolean)
2525

2626
// count the total number of comments including nested comments
27-
let ncomments = data.ncomments + freshNewComments.length
27+
let totalNComments = data.ncomments + freshNewComments.length
2828
for (const comment of freshNewComments) {
29-
ncomments += (comment.ncomments || 0)
29+
totalNComments += (comment.ncomments || 0)
3030
}
3131

3232
// update all ancestors
3333
const ancestors = data.path.split('.')
34-
updateAncestorsCommentCount(client, ancestors, ncomments)
34+
updateAncestorsCommentCount(client, ancestors, totalNComments)
3535

3636
return {
3737
...data,
3838
comments: { ...data.comments, comments: [...freshNewComments, ...data.comments.comments] },
39-
ncomments,
39+
ncomments: totalNComments,
4040
newComments: []
4141
}
4242
}

0 commit comments

Comments
 (0)