Fixes follower/following logic in suggested user annotations

This commit is contained in:
Mouse Reeve 2021-04-26 10:35:37 -07:00
parent 7449f34a61
commit 8b154b69fb

View file

@ -190,11 +190,11 @@ def get_annotated_users(user, *args, **kwargs):
.exclude(Q(id__in=user.blocks.all()) | Q(blocks=user)) .exclude(Q(id__in=user.blocks.all()) | Q(blocks=user))
.annotate( .annotate(
mutuals=Count( mutuals=Count(
"following", "followers",
filter=Q( filter=Q(
~Q(id=user.id), ~Q(id=user.id),
~Q(id__in=user.following.all()), ~Q(id__in=user.following.all()),
following__in=user.following.all(), followers__in=user.following.all(),
), ),
distinct=True, distinct=True,
), ),