Show reply threads in Home correctly
This commit is contained in:
parent
a5819fa64a
commit
03ba96ff26
@ -26,15 +26,16 @@ class FanOutStates(StateGraph):
|
|||||||
post = await fan_out.subject_post.afetch_full()
|
post = await fan_out.subject_post.afetch_full()
|
||||||
# Make a timeline event directly
|
# Make a timeline event directly
|
||||||
# If it's a reply, we only add it if we follow at least one
|
# 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
|
add = True
|
||||||
mentioned = {identity.id for identity in post.mentions.all()}
|
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:
|
if post.in_reply_to:
|
||||||
add = False
|
add = (post.author_id in followed) and bool(
|
||||||
async for follow in fan_out.identity.outbound_follows.all():
|
mentioned.intersection(followed)
|
||||||
if follow.target_id in mentioned:
|
)
|
||||||
add = True
|
|
||||||
break
|
|
||||||
if add:
|
if add:
|
||||||
await sync_to_async(TimelineEvent.add_post)(
|
await sync_to_async(TimelineEvent.add_post)(
|
||||||
identity=fan_out.identity,
|
identity=fan_out.identity,
|
||||||
|
Reference in New Issue
Block a user