Still trying...

This commit is contained in:
autocommit 2020-06-01 01:56:38 +00:00 committed by Cy
parent 09e5573b24
commit 7c692d4c49
No known key found for this signature in database
GPG Key ID: F66D599380F88521
2 changed files with 11 additions and 7 deletions

View File

@ -7,14 +7,18 @@ def maketree(descendants):
for descendant in descendants:
if not descendant.in_reply_to_id:
roots.add(descendant.id)
print("ROOT", descendant.id, descendant.account.acct)
print("ROOT", descendant.id, descendant.account.id, descendant.account.acct)
elif descendant.in_reply_to_id in replies:
reps = replies[descendant.in_reply_to_id]
reps.add(descendant.id)
print("REPLY", descendant.id, descendant.in_reply_to_id)
print("REPLY", descendant.id,
descendant.in_reply_to_id,
descendant.in_reply_to_id in lookup)
else:
reps = set()
print("NEWREPLY", descendant.id, descendant.in_reply_to_id)
print("NEWREPLY", descendant.id,
descendant.in_reply_to_id,
descendant.in_reply_to_id in lookup)
replies[descendant.in_reply_to_id] = set([descendant.id])
seen = set()
def onelevel(reps):

View File

@ -688,10 +688,10 @@ def thread(request, id):
notifications = _notes_count(account, mastodon)
filters = get_filters(mastodon, context="thread")
# Apply filters
descendants = [
x for x in context.descendants if not toot_matches_filters(x, filters)
]
# # Apply filters
# descendants = [
# x for x in context.descendants if not toot_matches_filters(x, filters)
# ]
posts = tuple(threadtree.build(descendants))
from pprint import pprint
pprint(posts)