From 03ba96ff26943f11b0ae1a21a0bcc39309b05901 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sun, 27 Nov 2022 12:20:58 -0700 Subject: Show reply threads in Home correctly --- activities/models/fan_out.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/activities/models/fan_out.py b/activities/models/fan_out.py index 14f52a4..8f4f342 100644 --- a/activities/models/fan_out.py +++ b/activities/models/fan_out.py @@ -26,15 +26,16 @@ class FanOutStates(StateGraph): post = await fan_out.subject_post.afetch_full() # Make a timeline event directly # If it's a reply, we only add it if we follow at least one - # of the people mentioned. + # of the people mentioned AND the author add = True mentioned = {identity.id for identity in post.mentions.all()} + followed = await sync_to_async(set)( + fan_out.identity.outbound_follows.values_list("id", flat=True) + ) if post.in_reply_to: - add = False - async for follow in fan_out.identity.outbound_follows.all(): - if follow.target_id in mentioned: - add = True - break + add = (post.author_id in followed) and bool( + mentioned.intersection(followed) + ) if add: await sync_to_async(TimelineEvent.add_post)( identity=fan_out.identity, -- cgit v1.2.3