Get thread children with depth first recusive search
This commit is contained in:
@ -9,7 +9,19 @@
|
||||
</a>
|
||||
</header>
|
||||
|
||||
{% include 'feed/thread.html' with status=status depth=0 max_depth=6 is_root=True direction=0 %}
|
||||
<div class="thread-parent is-relative block">
|
||||
<div class="thread">
|
||||
<div class="is-main block">
|
||||
{% include 'snippets/status/status.html' with status=status main=True %}
|
||||
</div>
|
||||
|
||||
{% for child in children %}
|
||||
<div class="block">
|
||||
{% include 'snippets/status/status.html' with status=child %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
@ -1,25 +0,0 @@
|
||||
{% load status_display %}
|
||||
|
||||
<div class="thread-parent is-relative block">
|
||||
<div class="thread">
|
||||
{% with depth=depth|add:1 %}
|
||||
{% if depth <= max_depth and status.reply_parent and direction <= 0 %}
|
||||
{% with direction=-1 %}
|
||||
{% include 'feed/thread.html' with status=status|parent is_root=False %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
|
||||
<div{% if is_root %} class="block mt-5 is-main"{% endif %}>
|
||||
{% include 'snippets/status/status.html' with status=status main=is_root %}
|
||||
</div>
|
||||
|
||||
{% if depth <= max_depth and direction >= 0 %}
|
||||
{% for reply in status|replies %}
|
||||
{% with direction=1 %}
|
||||
{% include 'feed/thread.html' with status=reply is_root=False %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user