{% macro time(comment) -%} {{ comment.created_at | format_datetime }} {%- endmacro %} {% macro comment_item(comment, comments_url, csrf_token, can_add=false, allow_replies=false, root=false, edit_comment_id=None, edit_body="", error="", error_field="", reply_parent=None, mention_url="", mention_model="", max_length=10000, read_only=false) %}
{{ comment.author_label }} {% if root and comment.resolved_at %}resolved{% endif %} {% if comment.edited_at %}edited{% endif %} {% if comment.deleted %}deleted{% endif %} {{ time(comment) }}
{% if comment.deleted and not comment.body %}
This comment was deleted{% if comment.deleted_by_label %} by {{ comment.deleted_by_label }}{% endif %}.
{% else %}
{{ comment.body }}
{% endif %} {% if root and comment.resolved_at %}
Resolved{% if comment.resolved_by_label %} by {{ comment.resolved_by_label }}{% endif %} · {{ comment.resolved_at | format_datetime }}
{% endif %} {% if error and edit_comment_id and edit_comment_id == comment.id %}
{{ error }}
{% endif %} {% if not read_only %}
{% if comment.can_edit %} {% endif %} {% if root and can_add and allow_replies and not comment.deleted %} {% endif %} {% if comment.can_delete %}
{% endif %} {% if root and comment.can_resolve %}
{% endif %}
{% if comment.can_edit %}
{% if error and edit_comment_id == comment.id and error_field == 'body' %}
{{ error }}
{% endif %}
{% endif %} {% if root and can_add and allow_replies and not comment.deleted %}
{% if reply_parent == comment.id %} {% else %} {% endif %} {% if error and reply_parent == comment.id %}
{{ error }}
{% endif %}
{% endif %} {% endif %}
{% endmacro %} {% macro thread_item(thread, comments_url, csrf_token, can_add=false, allow_replies=false, edit_comment_id=None, edit_body="", error="", error_field="", reply_parent=None, body_value="", mention_url="", mention_model="", max_length=10000, read_only=false) %}
{{ comment_item(thread.root, comments_url, csrf_token, can_add, allow_replies, true, edit_comment_id, edit_body, error, error_field, reply_parent, mention_url, mention_model, max_length, read_only) }} {% if thread.replies %}
{% for reply in thread.replies %} {{ comment_item(reply, comments_url, csrf_token, can_add, false, false, edit_comment_id, edit_body, error, error_field, none, mention_url, mention_model, max_length, read_only) }} {% endfor %}
{% endif %}
{% endmacro %} {% macro card(comments) %}

Comments {{ comments.count }}

{% if not comments.threads %}
No comments yet.
{% endif %} {% for thread in comments.threads %}
{{ thread.root.author_label }} {% if thread.root.resolved_at %}resolved{% endif %} {{ time(thread.root) }}
{{ thread.root.body }}
{% if thread.replies %}
{{ thread.replies | length }} repl{{ 'y' if thread.replies | length == 1 else 'ies' }}
{% endif %}
{% endfor %}
{% endmacro %}