]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/APDelivery.php
Use a constant for the avatar base path
[friendica.git] / src / Worker / APDelivery.php
index 6a1241293e2e359783321266d60caed9433850d5..37b47dd46dfd2c202815b24592fa918ca635e69b 100644 (file)
@@ -68,7 +68,7 @@ class APDelivery
                }
 
                if (!$success && !Worker::defer() && in_array($cmd, [Delivery::POST])) {
-                       if ($uri_id) {
+                       if (!empty($uri_id)) {
                                Post\Delivery::remove($uri_id, $inbox);
                                Post\DeliveryData::incrementQueueFailed($uri_id);
                        } elseif (!empty($uri_ids)) {
@@ -78,7 +78,7 @@ class APDelivery
                                }
                        }
                } elseif ($success && in_array($cmd, [Delivery::POST])) {
-                       if ($uri_id) {
+                       if (!empty($uri_id)) {
                                Post\DeliveryData::incrementQueueDone($uri_id, Post\DeliveryData::ACTIVITYPUB);
                        } elseif (!empty($uri_ids)) {
                                foreach ($uri_ids as $uri_id) {
@@ -112,15 +112,14 @@ class APDelivery
                        if (empty($receivers) && !empty($item)) {
                                $parent = Post::selectFirst(Item::DELIVER_FIELDLIST, ['id' => $item['parent']]);
 
-                               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);
-                               }
-
+                               $inboxes = ActivityPub\Transmitter::fetchTargetInboxes($parent, $uid);
                                $receivers = $inboxes[$inbox] ?? [];
+
+                               // When we haven't fetched the receiver list, it can be a personal inbox
+                               if (empty($receivers)) {
+                                       $inboxes = ActivityPub\Transmitter::fetchTargetInboxes($parent, $uid, true);
+                                       $receivers = $inboxes[$inbox] ?? [];
+                               }                                       
                        }
                }