fix follower list

This commit is contained in:
Your Name 2023-08-20 18:45:28 +00:00 committed by Henri Dickson
parent c45e9f6016
commit 0f1d1e0cde
2 changed files with 4 additions and 2 deletions

View file

@ -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

View file

@ -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)