forked from mirrors/bookwyrm
Merge pull request #1007 from bookwyrm-social/suggested_user_logic
Fixes follower/following logic in suggested user annotations
This commit is contained in:
commit
30a6c035b8
2 changed files with 4 additions and 4 deletions
|
@ -219,7 +219,7 @@ class ViewsHelpers(TestCase):
|
|||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||
# 1 shared follow
|
||||
self.local_user.following.add(user_2)
|
||||
user_1.following.add(user_2)
|
||||
user_1.followers.add(user_2)
|
||||
|
||||
# 1 shared book
|
||||
models.ShelfBook.objects.create(
|
||||
|
@ -264,7 +264,7 @@ class ViewsHelpers(TestCase):
|
|||
local=True,
|
||||
localname=i,
|
||||
)
|
||||
user.followers.add(user_1)
|
||||
user.following.add(user_1)
|
||||
user.followers.add(self.local_user)
|
||||
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||
|
|
|
@ -190,11 +190,11 @@ def get_annotated_users(user, *args, **kwargs):
|
|||
.exclude(Q(id__in=user.blocks.all()) | Q(blocks=user))
|
||||
.annotate(
|
||||
mutuals=Count(
|
||||
"following",
|
||||
"followers",
|
||||
filter=Q(
|
||||
~Q(id=user.id),
|
||||
~Q(id__in=user.following.all()),
|
||||
following__in=user.following.all(),
|
||||
followers__in=user.following.all(),
|
||||
),
|
||||
distinct=True,
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue