From 0f1d1e0cded7310f824854849f0f410a44cc879a Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 20 Aug 2023 18:45:28 +0000 Subject: [PATCH] fix follower list --- takahe/utils.py | 4 ++-- users/tests.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/takahe/utils.py b/takahe/utils.py index 0f25df2d..c44368f0 100644 --- a/takahe/utils.py +++ b/takahe/utils.py @@ -182,7 +182,7 @@ class Takahe: def get_follower_ids(identity_pk: int): targets = Follow.objects.filter( target_id=identity_pk, state="accepted" - ).values_list("target", flat=True) + ).values_list("source", flat=True) return list(targets) @staticmethod @@ -196,7 +196,7 @@ class Takahe: def get_requested_follower_ids(identity_pk: int): targets = Follow.objects.filter( target_id=identity_pk, state="pending_approval" - ).values_list("target", flat=True) + ).values_list("source", flat=True) return list(targets) @staticmethod diff --git a/users/tests.py b/users/tests.py index 6506a699..3e0a555e 100644 --- a/users/tests.py +++ b/users/tests.py @@ -41,12 +41,14 @@ class UserTest(TestCase): self.assertTrue(self.alice.is_following(self.bob)) self.assertTrue(self.bob.is_followed_by(self.alice)) self.assertEqual(self.alice.following, [self.bob.pk]) + self.assertEqual(self.bob.followers, [self.alice.pk]) self.alice.unfollow(self.bob) Takahe._force_state_cycle() self.assertFalse(self.alice.is_following(self.bob)) self.assertFalse(self.bob.is_followed_by(self.alice)) self.assertEqual(self.alice.following, []) + self.assertEqual(self.bob.followers, []) def test_mute(self): self.alice.mute(self.bob)