Adding an outer IN/OUT
If we have multiple roots ever, we need the whole thing in a big <ul></ul>
This commit is contained in:
parent
88d6c6f3ce
commit
4ad3538017
|
@ -5,7 +5,6 @@ def maketree(descendants):
|
||||||
replies = {}
|
replies = {}
|
||||||
roots = set()
|
roots = set()
|
||||||
for descendant in descendants:
|
for descendant in descendants:
|
||||||
pprint(descendant)
|
|
||||||
if not descendant.in_reply_to_id:
|
if not descendant.in_reply_to_id:
|
||||||
roots.add(descendant.id)
|
roots.add(descendant.id)
|
||||||
if descendant.in_reply_to_id in replies:
|
if descendant.in_reply_to_id in replies:
|
||||||
|
@ -54,4 +53,6 @@ def unmaketree(tree):
|
||||||
yield OUT
|
yield OUT
|
||||||
|
|
||||||
def build(descendants):
|
def build(descendants):
|
||||||
return unmaketree(maketree(descendants))
|
yield IN
|
||||||
|
yield from unmaketree(maketree(descendants))
|
||||||
|
yield OUT
|
||||||
|
|
|
@ -700,7 +700,7 @@ def thread(request, id):
|
||||||
"context": context,
|
"context": context,
|
||||||
"toot": toot,
|
"toot": toot,
|
||||||
"root": root,
|
"root": root,
|
||||||
"posts": threadtree.build(descendants),
|
"posts": tuple(threadtree.build(descendants)),
|
||||||
"own_acct": request.session["active_user"],
|
"own_acct": request.session["active_user"],
|
||||||
"notifications": notifications,
|
"notifications": notifications,
|
||||||
"preferences": account.preferences,
|
"preferences": account.preferences,
|
||||||
|
|
Loading…
Reference in New Issue