do not deliver follower-only post to hashtag followers

This commit is contained in:
Henri Dickson 2024-02-06 00:10:47 -05:00
parent f86f3a49e4
commit d0ed35591b

View file

@ -766,19 +766,21 @@ class Post(StatorModel):
for mention in self.mentions.all(): for mention in self.mentions.all():
targets.add(mention) targets.add(mention)
if self.visibility in [Post.Visibilities.public, Post.Visibilities.unlisted]: if self.visibility in [Post.Visibilities.public, Post.Visibilities.unlisted]:
# deliver edit to all previously interacted to this post
for interaction in self.interactions.all(): for interaction in self.interactions.all():
targets.add(interaction.identity) targets.add(interaction.identity)
# Then, if it's not mentions only, also deliver to followers and all hashtag followers # deliver to all hashtag followers
if self.visibility != Post.Visibilities.mentioned:
for follower in self.author.inbound_follows.filter(
state__in=FollowStates.group_active()
).select_related("source"):
targets.add(follower.source)
if self.hashtags: if self.hashtags:
for follow in HashtagFollow.objects.by_hashtags( for follow in HashtagFollow.objects.by_hashtags(
self.hashtags self.hashtags
).prefetch_related("identity"): ).prefetch_related("identity"):
targets.add(follow.identity) targets.add(follow.identity)
# Then, if it's not mentions only, also deliver to followers
if self.visibility != Post.Visibilities.mentioned:
for follower in self.author.inbound_follows.filter(
state__in=FollowStates.group_active()
).select_related("source"):
targets.add(follower.source)
# If it's a reply, always include the original author if we know them # If it's a reply, always include the original author if we know them
reply_post = self.in_reply_to_post() reply_post = self.in_reply_to_post()