From 9c2fe81ac6ddd24de1768a56dca7529d8d0d8286 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 2 May 2022 05:53:11 +0000 Subject: [PATCH] Transmit via the sharedInbox --- src/Worker/APDelivery.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Worker/APDelivery.php b/src/Worker/APDelivery.php index 299eeba359..6a1241293e 100644 --- a/src/Worker/APDelivery.php +++ b/src/Worker/APDelivery.php @@ -107,12 +107,18 @@ class APDelivery private static function deliverToInbox(string $cmd, int $item_id, string $inbox, int $uid, array $receivers, int $uri_id) { if (empty($item_id) && !empty($uri_id) && !empty($uid)) { - $item = Post::selectFirst(['id', 'parent'], ['uri-id' => $uri_id, 'uid' => $uid]); + $item = Post::selectFirst(['id', 'parent', 'origin'], ['uri-id' => $uri_id, 'uid' => $uid]); $item_id = $item['id'] ?? 0; if (empty($receivers) && !empty($item)) { $parent = Post::selectFirst(Item::DELIVER_FIELDLIST, ['id' => $item['parent']]); - $inboxes = ActivityPub\Transmitter::fetchTargetInboxes($parent, $uid, true, $item['id']); + if ($item['origin']) { + $inboxes = ActivityPub\Transmitter::fetchTargetInboxes($parent, $uid); + } else { + // Remote items are transmitted via the personal inboxes. + // Doing so ensures that the dedicated receiver will get the message. + $inboxes = ActivityPub\Transmitter::fetchTargetInboxes($parent, $uid, true, $item_id); + } $receivers = $inboxes[$inbox] ?? []; }