Fixes filters

This commit is contained in:
Mouse Reeve
2021-09-08 12:06:23 -07:00
parent 88a65b0b88
commit 4db5677509
2 changed files with 11 additions and 6 deletions

View File

@ -43,6 +43,7 @@ class SuggestedUsers(RedisStore):
~Q(id=user.id),
~Q(followers=user),
~Q(follower_requests=user),
bookwyrm_user=True,
)
def get_stores_for_object(self, obj):
@ -106,9 +107,7 @@ class SuggestedUsers(RedisStore):
def get_annotated_users(viewer, *args, **kwargs):
"""Users, annotated with things they have in common"""
return (
models.User.objects.filter(
discoverable=True, is_active=True, bookwyrm_user=True, *args, **kwargs
)
models.User.objects.filter(discoverable=True, is_active=True, *args, **kwargs)
.exclude(Q(id__in=viewer.blocks.all()) | Q(blocks=viewer))
.annotate(
mutuals=Count(
@ -196,7 +195,7 @@ def update_user(sender, instance, created, update_fields=None, **kwargs):
return
# deleted the user
if not instance.is_active:
if not created and not instance.is_active:
remove_user_task.delay(instance.id)
return