diff options
author | Andrew Godwin | 2022-11-27 12:20:58 -0700 |
---|---|---|
committer | Andrew Godwin | 2022-11-27 12:21:16 -0700 |
commit | 03ba96ff26943f11b0ae1a21a0bcc39309b05901 (patch) | |
tree | 9361a2b1ab6557aa7c24e0b31ba7e2bf536b1d8c | |
parent | a5819fa64ab8a97601b1a666967269caf3292326 (diff) | |
download | takahe-03ba96ff26943f11b0ae1a21a0bcc39309b05901.tar.gz takahe-03ba96ff26943f11b0ae1a21a0bcc39309b05901.tar.bz2 takahe-03ba96ff26943f11b0ae1a21a0bcc39309b05901.zip |
Show reply threads in Home correctly
-rw-r--r-- | activities/models/fan_out.py | 13 |
1 files 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, |