fix: backfeed whole reply threads and nest them (v2.20.2)

Backfeed only read first-level replies (Threads /replies, GoToSocial
direct replies, Bluesky depth 1) and skipped the owner's own replies, so
conversations under crossposts lost everything after the first reply.

- Threads /conversation, all GoToSocial descendants, Bluesky depth 10
- backfeed.thread_members keeps others' replies to our copy and any reply
  (ours included) to a kept reply; own replies are stored as notified
- Migration 026: webmentions.parent_remote_id; replies render nested as
  comments of comments

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PhilandClaude Opus 5.5 committed 2026-11-13 20:43:30 -07:00
1 parent 952ca300c0
commit bf6e0fdc0b
11 files changed
+283 -42

No files matched your search

+23
View File
@@ -107,9 +107,32 @@ def get_webmentions_for_note(note_id: int) -> Dict[str, List[Dict[str, Any]]]:
else:
grouped['mentions'].append(wm)
grouped['reply_threads'] = reply_threads(grouped['replies'])
return grouped
def reply_threads(replies: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
"""
Replies nested under the replies they answer (v2.20.2): each gets
'children'; the top-level ones are returned. A reply whose parent isn't
shown (hidden, removed) is shown at the top level.
"""
by_id = {}
for wm in replies:
wm['children'] = []
if wm.get('remote_id'):
by_id[(wm.get('origin'), wm['remote_id'])] = wm
top = []
for wm in replies:
parent = by_id.get((wm.get('origin'), wm.get('parent_remote_id'))) \
if wm.get('parent_remote_id') else None
if parent is not None and parent is not wm:
parent['children'].append(wm)
else:
top.append(wm)
return top
def response_counts(note_ids: List[int]) -> Dict[int, Dict[str, int]]:
"""
Likes, reposts, replies and quotes per note, for lists of notes