More thorough check to prevent following blocked users

This commit is contained in:
Mouse Reeve 2021-02-12 18:14:51 -08:00
parent d250127062
commit 4a58cd42a6

View file

@ -82,11 +82,16 @@ class UserFollowRequest(ActivitypubMixin, UserRelationship):
try: try:
UserFollows.objects.get( UserFollows.objects.get(
user_subject=self.user_subject, user_subject=self.user_subject,
user_object=self.user_object user_object=self.user_object,
) )
# blocking in either direction is a no-go
UserBlocks.objects.get( UserBlocks.objects.get(
user_subject=self.user_subject, user_subject=self.user_subject,
user_object=self.user_object user_object=self.user_object,
)
UserBlocks.objects.get(
user_subject=self.user_object,
user_object=self.user_subject,
) )
return None return None
except (UserFollows.DoesNotExist, UserBlocks.DoesNotExist): except (UserFollows.DoesNotExist, UserBlocks.DoesNotExist):