mirror of
https://github.com/wassname/talk.git
synced 2026-08-16 11:29:31 +08:00
Removing dynamic containers from CommentStream
This commit is contained in:
@@ -2,14 +2,16 @@ import React from 'react'
|
||||
|
||||
const name = 'coral-plugin-comment-count'
|
||||
|
||||
const CommentCount = ({comment}) => {
|
||||
const CommentCount = ({items, item_id}) => {
|
||||
let count = 0
|
||||
if (comment) {
|
||||
count += comment.length
|
||||
for (var i=0; i < comment.length; i++) {
|
||||
if (comment[i].child) {
|
||||
count += comment[i].child.length
|
||||
}
|
||||
if (items[item_id]) {
|
||||
count += items[item_id].related.comment.length
|
||||
}
|
||||
const itemKeys = Object.keys(items)
|
||||
for (var i=0; i < itemKeys.length; i++) {
|
||||
const item = items[itemKeys[i]]
|
||||
if (item.type === 'comment' && item.related && item.related.child) {
|
||||
count += item.related.child.length
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user