Partial checkin: deliver() now iterates over a given user's followers. This is insufficiently tested as yet.

deliver()'s target_people param now has a default of [], for parallelism with target_followers_of.
status-serialisers
Marnanel Thurman 2020-09-14 01:15:27 +01:00
rodzic e3520eee53
commit c4cf668cc2
2 zmienionych plików z 27 dodań i 3 usunięć

Wyświetl plik

@ -250,7 +250,7 @@ def _deliver_remote(
def deliver(
activity,
sender,
target_people,
target_people = [],
target_followers_of = [],
):
@ -295,5 +295,16 @@ def deliver(
postie.send_to(target.inbox)
for following in target_followers_of:
logger.debug("outgoing %s: sending to person %s's followers...",
message.pk, following)
for follower in following.followers:
logger.debug("outgoing %s: -- to %s",
message.pk, follower)
postie.send_to(follower.inbox)
logger.debug('outgoing %s: message posted to all inboxes',
message.pk)

Wyświetl plik

@ -11,6 +11,7 @@ from unittest import skip
from django.test import TestCase
from kepi.sombrero_sendpub.delivery import deliver
from kepi.bowler_pub.tests import create_local_person
from kepi.trilby_api.models import Follow
import json
TEST_ACTIVITY = {"hello": "world"}
@ -46,9 +47,21 @@ class TestDelivery(TestCase):
],
)
@skip(reason="nyi")
def test_send_to_followers_of_local_user(self):
pass
alice = create_local_person("alice")
bob = create_local_person("bob")
carol = create_local_person("carol")
Follow(following=alice, follower=bob).save()
Follow(following=alice, follower=carol).save()
deliver(
activity = TEST_ACTIVITY,
sender = alice,
target_followers_of = [
alice,
],
)
@skip(reason="nyi")
def test_send_to_remote_user(self):