Count comments and replies, not just top-level comments
This commit is contained in:
parent
ea2be0f13d
commit
7f4ad85781
@ -206,10 +206,14 @@ def comments_for_node(node_id):
|
|||||||
for reply in comment['_replies']['_items']:
|
for reply in comment['_replies']['_items']:
|
||||||
enrich(reply)
|
enrich(reply)
|
||||||
|
|
||||||
|
nr_of_comments = sum(1 + comment['_replies']['_meta']['total']
|
||||||
|
for comment in comments['_items'])
|
||||||
|
|
||||||
# Data will be requested via javascript
|
# Data will be requested via javascript
|
||||||
return render_template('nodes/custom/comment/list_embed.html',
|
return render_template('nodes/custom/comment/list_embed.html',
|
||||||
node_id=node_id,
|
node_id=node_id,
|
||||||
comments=comments,
|
comments=comments,
|
||||||
|
nr_of_comments=nr_of_comments,
|
||||||
can_post_comments=can_post_comments)
|
can_post_comments=can_post_comments)
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
|
|
||||||
section#comments-list-header
|
section#comments-list-header
|
||||||
#comments-list-title
|
#comments-list-title
|
||||||
| {% if comments['_meta']['total'] == 0 %}No{% else %}{{ comments['_meta']['total'] }}{% endif %} comment{{ comments['_meta']['total']|pluralize }}
|
| {% if nr_of_comments == 0 %}No{% else %}{{ nr_of_comments }}{% endif %} comment{{ nr_of_comments|pluralize }}
|
||||||
#comments-list-items
|
#comments-list-items
|
||||||
| {% for comment in comments['_items'] %}
|
| {% for comment in comments['_items'] %}
|
||||||
| {{ macros.render_comment(comment, False) }}
|
| {{ macros.render_comment(comment, False) }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user