{# Set default depth if not provided #} {% set depth = depth | default(0) %} {% set max_depth = 10 %} {# Prevent infinite recursion by limiting depth #} {% if depth < max_depth %}
{{ (comment.author.full_name or comment.author.username)[0].upper() }}
{{ comment.author.full_name or comment.author.username }} {% if comment.author.is_admin %} {{ _('Admin') }} {% endif %}
{% if comment.created_at != comment.updated_at %} {{ _('edited') }} {% endif %}
{% if comment.can_edit(current_user) %} {% endif %} {% if comment.can_delete(current_user) %} {% endif %}
{{ comment.content | nl2br | safe }}
{% if comment.project_id %} {% else %} {% endif %}
{% if comment.replies and depth < max_depth %}
{% for reply in comment.replies %}
{% with comment=reply, depth=depth+1 %} {% include 'comments/_comment.html' %} {% endwith %}
{% endfor %}
{% elif comment.replies and depth >= max_depth %}
{{ _('Replies are too deeply nested to display.') }}
{% endif %}
{% else %} {# Depth limit reached - show placeholder #}
{{ _('Comment nesting too deep to display.') }}
{% endif %}