{% macro comment_cell(item, depth, parent_author=None) %}
{{ item.votes.up - item.votes.down }}
{% set _user = item.author %}{% set _size = 32 %}{% set _size_class = "sm" %}{% include "_avatar_link.html" %} {% set _user = item.author %}{% set _class = "comment-author" %}{% include "_user_link.html" %} {% if parent_author %}↳ @{{ parent_author.get('username', '') }}{% endif %} {{ dt_ago(item.comment.get('created_at')) if item.comment.get('created_at') else item.time_ago }}
{{ render_content(item.comment['content'], author_is_admin=is_admin(item.author)) }}
{% set attachments = item.get('attachments', []) %} {% if attachments %} {% include "_attachment_display.html" %} {% endif %}
{% if owns(item.comment, user) %} {% endif %} {% if owns(item.comment, user) or is_admin(user) %}
{% endif %} {% set _type = "comment" %}{% set _uid = item.comment['uid'] %}{% set _reactions = item.reactions %}{% include "_reaction_bar.html" %} {% set _type = "comment" %}{% set _uid = item.comment['uid'] %}{% set _owner = item.comment['user_uid'] %}{% set _owner_name = (item.author or {}).get('username', '') %}{% set _class = "comment-action-btn" %}{% include "_report_button.html" %}
{{ caller() }}
{% endmacro %} {% macro render_comment(item, depth=0) %} {% set max_depth = 2 %} {% set visual_depth = depth if depth < max_depth else max_depth %} {% call comment_cell(item, visual_depth) %} {% if item.children %} {% if depth < max_depth %}
{% for child in item.children %} {{ render_comment(child, depth + 1) }} {% endfor %}
{% else %}
{% for child in item.children %} {{ render_comment_flat(child, max_depth, item.author) }} {% endfor %}
{% endif %} {% endif %} {% endcall %} {% endmacro %} {% macro render_comment_flat(item, depth, parent_author) %} {% call comment_cell(item, depth, parent_author) %}{% endcall %} {% for child in item.children %} {{ render_comment_flat(child, depth, item.author) }} {% endfor %} {% endmacro %}