bug fix, don't deliver activities to users if their Follower is inactive

pull/438/head
Ryan Barrett 2023-03-04 12:12:45 -08:00
rodzic fa2a9a1afe
commit bc15902bed
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
2 zmienionych plików z 3 dodań i 0 usunięć

Wyświetl plik

@ -235,6 +235,7 @@ def inbox(domain=None):
if obj.type in ('share', 'create', 'post') and actor and actor_id:
logger.info(f'Delivering to followers of {actor_id}')
for f in Follower.query(Follower.dest == actor_id,
Follower.status == 'active',
projection=[Follower.src]):
if f.src not in obj.domains:
obj.domains.append(f.src)

Wyświetl plik

@ -365,6 +365,7 @@ class ActivityPubTest(testutil.TestCase):
Follower.get_or_create(NOTE['actor'], 'foo.com')
Follower.get_or_create('http://other/actor', 'bar.com')
Follower.get_or_create(NOTE['actor'], 'baz.com')
Follower.get_or_create(NOTE['actor'], 'baj.com', status='inactive')
mock_head.return_value = requests_response(url='http://target')
mock_get.return_value = self.as2_resp(ACTOR) # source actor
@ -440,6 +441,7 @@ class ActivityPubTest(testutil.TestCase):
def test_shared_inbox_repost(self, mock_head, mock_get, mock_post):
Follower.get_or_create(ACTOR['id'], 'foo.com')
Follower.get_or_create(ACTOR['id'], 'baz.com')
Follower.get_or_create(ACTOR['id'], 'baj.com', status='inactive')
mock_head.return_value = requests_response(url='http://target')
mock_get.side_effect = [