Comments history in comment detail view
What are you trying to do?
Hi,
One of our clients would like to have the comments history inside a comment detail view if it is answer to another comment.
What's your proposed solution?
I did something ugly in the "_edit.html" file for testing purpose, with in case there might be many.
`{% set parents = craft.comments.fetch() .ancestorOf(comment) .all() %}
{% if parents %}
<div class="field">
<details>
<summary class="heading">{{ 'Reply from comment(s)' | t('comments') }}</summary>
<ul>
{% nav parent in parents %}
<li{% if not loop.first %} style="margin-left: 10px;"{% endif %}>
↪ {{ parent.comment }}
{% ifchildren %}
<ul>
{% children %}
</ul>
{% endifchildren %}
</li>
{% endnav %}
</ul>
</details>
</div>
<hr>
{% endif %}`
Would you have any suggestion for improvement?
Additional context
Would this be different to the current "Replies" section, where you can see the replies on a comment? Or more the other way around (on a reply, show the parent comment)?
I think what you've done is fine! I'm not sure how useful it'd be to see the hierarchy of other comments for everyone else (that's what the comments index is for), so some custom templating as you've done makes a good fit.
I'll try to make it look like more the "Replies" section. Indeed, it is more the other way around, before approving the comment, the moderator would be able to see the parents comments, to have the context before deciding.