mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 11:14:28 +00:00
Fix thread issue
This commit is contained in:
parent
6b464d2a6d
commit
ff55b9e9dc
1 changed files with 4 additions and 5 deletions
9
app.py
9
app.py
|
@ -737,7 +737,8 @@ def _build_thread(data, include_children=True):
|
||||||
print(data)
|
print(data)
|
||||||
root_id = data["meta"].get("thread_root_parent", data["activity"]["object"]["id"])
|
root_id = data["meta"].get("thread_root_parent", data["activity"]["object"]["id"])
|
||||||
|
|
||||||
query = {"$or": [{"meta.thread_root_parent": root_id, "type": "Create"}]}
|
query = {"$or": [{"meta.thread_root_parent": root_id, "type": "Create"},
|
||||||
|
{"activity.object.id": root_id}]}
|
||||||
if data["activity"]["object"].get("inReplyTo"):
|
if data["activity"]["object"].get("inReplyTo"):
|
||||||
query["$or"].append(
|
query["$or"].append(
|
||||||
{"activity.object.id": data["activity"]["object"]["inReplyTo"]}
|
{"activity.object.id": data["activity"]["object"]["inReplyTo"]}
|
||||||
|
@ -763,10 +764,8 @@ def _build_thread(data, include_children=True):
|
||||||
if rep_id == root_id:
|
if rep_id == root_id:
|
||||||
continue
|
continue
|
||||||
reply_of = rep["activity"]["object"]["inReplyTo"]
|
reply_of = rep["activity"]["object"]["inReplyTo"]
|
||||||
try:
|
idx[reply_of]["_nodes"].append(rep)
|
||||||
idx[reply_of]["_nodes"].append(rep)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
# Flatten the tree
|
# Flatten the tree
|
||||||
thread = []
|
thread = []
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue