From 201610dfe6acbc3756fcd106328312d0ce6cf22c Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Fri, 13 May 2022 04:24:22 +0200 Subject: [PATCH] Don't look at the command when archiving an inbox --- src/Worker/APDelivery.php | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/Worker/APDelivery.php b/src/Worker/APDelivery.php index 3fb389313..641f27fce 100644 --- a/src/Worker/APDelivery.php +++ b/src/Worker/APDelivery.php @@ -48,22 +48,20 @@ class APDelivery { if (ActivityPub\Transmitter::archivedInbox($inbox)) { Logger::info('Inbox is archived', ['cmd' => $cmd, 'inbox' => $inbox, 'id' => $item_id, 'uri-id' => $uri_id, 'uid' => $uid]); - if (in_array($cmd, [Delivery::POST])) { - if (empty($uri_id) && !empty($item_id)) { - $item = Post::selectFirst(['uri-id'], ['id' => $item_id]); - $uri_id = $item['uri-id'] ?? 0; - } - if (empty($uri_id)) { - $posts = Post\Delivery::selectForInbox($inbox); - $uri_ids = array_column($posts, 'uri-id'); - } else { - $uri_ids = [$uri_id]; - } - - foreach ($uri_ids as $uri_id) { - Post\Delivery::remove($uri_id, $inbox); - Post\DeliveryData::incrementQueueFailed($uri_id); - } + if (empty($uri_id) && !empty($item_id)) { + $item = Post::selectFirst(['uri-id'], ['id' => $item_id]); + $uri_id = $item['uri-id'] ?? 0; + } + if (empty($uri_id)) { + $posts = Post\Delivery::selectForInbox($inbox); + $uri_ids = array_column($posts, 'uri-id'); + } else { + $uri_ids = [$uri_id]; + } + + foreach ($uri_ids as $uri_id) { + Post\Delivery::remove($uri_id, $inbox); + Post\DeliveryData::incrementQueueFailed($uri_id); } return; } @@ -79,7 +77,7 @@ class APDelivery $uri_ids = [$uri_id]; } - if (!$success && !Worker::defer() && in_array($cmd, [Delivery::POST])) { + if (!$success && !Worker::defer() && !empty($uri_ids)) { foreach ($uri_ids as $uri_id) { Post\Delivery::remove($uri_id, $inbox); Post\DeliveryData::incrementQueueFailed($uri_id);