mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 03:04:28 +00:00
Fix threads
This commit is contained in:
parent
57c1ad0932
commit
d2ce70df65
1 changed files with 4 additions and 1 deletions
5
app.py
5
app.py
|
@ -843,10 +843,13 @@ def _build_thread(data, include_children=True): # noqa: C901
|
||||||
}
|
}
|
||||||
replies = [data]
|
replies = [data]
|
||||||
for dat in DB.activities.find(query):
|
for dat in DB.activities.find(query):
|
||||||
if dat["type"][0] != ActivityType.CREATE.value:
|
if dat["type"][0] == ActivityType.CREATE.value:
|
||||||
|
replies.append(dat)
|
||||||
|
else:
|
||||||
# Make a Note/Question/... looks like a Create
|
# Make a Note/Question/... looks like a Create
|
||||||
dat = {"activity": {"object": dat["activity"]}, "meta": dat["meta"], "_id": dat["_id"]}
|
dat = {"activity": {"object": dat["activity"]}, "meta": dat["meta"], "_id": dat["_id"]}
|
||||||
replies.append(dat)
|
replies.append(dat)
|
||||||
|
|
||||||
replies = sorted(replies, key=lambda d: d["activity"]["object"]["published"])
|
replies = sorted(replies, key=lambda d: d["activity"]["object"]["published"])
|
||||||
|
|
||||||
# Index all the IDs in order to build a tree
|
# Index all the IDs in order to build a tree
|
||||||
|
|
Loading…
Reference in a new issue