Skip to content

Commit

Permalink
Merge pull request #6 from neodb-social/hashtag-follow-fix
Browse files Browse the repository at this point in the history
do not deliver follower-only post to hashtag followers
  • Loading branch information
dcwatson authored Apr 22, 2024
2 parents 8e788aa + d0ed355 commit 2ee0528
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions activities/models/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,19 +767,21 @@ def get_targets(self) -> Iterable[Identity]:
for mention in self.mentions.all():
targets.add(mention)
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():
targets.add(interaction.identity)
# Then, if it's not mentions only, also deliver to followers and 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)
# deliver to all hashtag followers
if self.hashtags:
for follow in HashtagFollow.objects.by_hashtags(
self.hashtags
).prefetch_related("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
reply_post = self.in_reply_to_post()
Expand Down

0 comments on commit 2ee0528

Please sign in to comment.