2026-06-05 16:43:12 +00:00
{% macro render_comment(item, depth=0) %}
< div class = "comment" style = "--comment-depth: {{ depth }};" data-depth = "{{ depth }}" >
< div class = "comment-votes" >
< form method = "POST" action = "/votes/comment/{{ item.comment['uid'] }}" >
< input type = "hidden" name = "value" value = "1" >
2026-06-08 15:38:33 +00:00
< button type = "submit" class = "comment-vote-btn vote-up{% if item.my_vote == 1 %} voted{% endif %}" aria-label = "Upvote" title = "Upvote" {{ guest_disabled ( user ) }} > +</ button >
2026-06-05 16:43:12 +00:00
</ form >
< span class = "comment-vote-count" data-vote-count = "{{ item.comment['uid'] }}" > {{ item.votes.up - item.votes.down }}</ span >
< form method = "POST" action = "/votes/comment/{{ item.comment['uid'] }}" >
< input type = "hidden" name = "value" value = "-1" >
2026-06-08 15:38:33 +00:00
< button type = "submit" class = "comment-vote-btn vote-down{% if item.my_vote == -1 %} voted{% endif %}" aria-label = "Downvote" title = "Downvote" {{ guest_disabled ( user ) }} > -</ button >
2026-06-05 16:43:12 +00:00
</ form >
</ div >
< div class = "comment-body" id = "comment-{{ item.comment['uid'] }}" data-comment-uid = "{{ item.comment['uid'] }}" >
< div class = "comment-header" >
2026-06-12 03:37:12 +00:00
{% set _user = item.author %}{% set _size = 32 %}{% set _size_class = "sm" %}{% include "_avatar_link.html" %}
2026-06-05 16:43:12 +00:00
{% set _user = item.author %}{% set _class = "comment-author" %}{% include "_user_link.html" %}
< span class = "comment-time" > {{ item.time_ago }}</ span >
</ div >
2026-06-15 12:10:14 +00:00
< div class = "comment-text rendered-content" data-render data-raw = "{{ item.comment['content'] }}" > {{ item.comment['content'] }}</ div >
2026-06-05 16:43:12 +00:00
{% set attachments = item.get('attachments', []) %}
{% if attachments %}
{% include "_attachment_display.html" %}
{% endif %}
< div class = "comment-actions" >
2026-06-16 00:44:12 +02:00
< button type = "button" class = "comment-action-btn" data-action = "reply" {{ guest_disabled ( user ) }} >< span class = "icon" > 💬</ span >< span class = "label" > Reply</ span ></ button >
2026-06-08 15:38:33 +00:00
{% if owns(item.comment, user) %}
2026-06-16 00:44:12 +02:00
< button type = "button" class = "comment-action-btn" data-action = "edit" data-edit-url = "/comments/edit/{{ item.comment['uid'] }}" >< span class = "icon" > ✏️</ span >< span class = "label" > Edit</ span ></ button >
2026-06-15 12:10:14 +00:00
< form method = "POST" action = "/comments/delete/{{ item.comment['uid'] }}" class = "inline-form comment-delete-form" data-comment-uid = "{{ item.comment['uid'] }}" >
2026-06-16 00:44:12 +02:00
< button type = "submit" class = "comment-action-btn" data-confirm = "Delete this comment?" >< span class = "icon" > 🗑️</ span >< span class = "label" > Delete</ span ></ button >
2026-06-05 16:43:12 +00:00
</ form >
{% endif %}
2026-06-06 14:31:42 +00:00
{% set _type = "comment" %}{% set _uid = item.comment['uid'] %}{% set _reactions = item.reactions %}{% include "_reaction_bar.html" %}
2026-06-05 16:43:12 +00:00
</ div >
{% if item.children %}
< div class = "comment-replies" >
{% for child in item.children %}
{{ render_comment(child, depth + 1) }}
{% endfor %}
</ div >
{% endif %}
</ div >
</ div >
{% endmacro %}