From ad62b79da919c480c850f4ec0b67137c5d8165d0 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Wed, 6 Jul 2022 22:32:21 +0200 Subject: [PATCH] Improve actor updates recipients --- app/outgoing_activities.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/outgoing_activities.py b/app/outgoing_activities.py index e7db4d5..b1b265c 100644 --- a/app/outgoing_activities.py +++ b/app/outgoing_activities.py @@ -90,7 +90,8 @@ def _send_actor_update_if_needed(db_session: Session) -> None: db_session.add(outbox_object) db_session.flush() - # TODO(ts): also send to every actor we contact (distinct on recipient) + # Send the update to the followers collection and all the actor we have ever + # contacted followers = ( ( db_session.scalars( @@ -103,7 +104,12 @@ def _send_actor_update_if_needed(db_session: Session) -> None: for rcp in { follower.actor.shared_inbox_url or follower.actor.inbox_url for follower in followers - }: + } + { + row.recipient + for row in db_session.execute( + select(func.distinct(models.OutgoingActivity.recipient).label("recipient")) + ) + }: # type: ignore outgoing_activity = models.OutgoingActivity( recipient=rcp, outbox_object_id=outbox_object.id,