]> git.mxchange.org Git - friendica.git/commitdiff
Remove delivery when the inbox is archived
authorMichael <heluecht@pirati.ca>
Fri, 13 May 2022 02:11:02 +0000 (02:11 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 13 May 2022 02:11:02 +0000 (02:11 +0000)
src/Worker/APDelivery.php

index b3667d653cc837e2611ab5ae2e949b6252e7a497..1ec0ba47cee87c27bc94d5fa1a333b0cc09a3c74 100644 (file)
@@ -47,10 +47,14 @@ class APDelivery
        public static function execute(string $cmd, int $item_id, string $inbox, int $uid, array $receivers = [], int $uri_id = 0)
        {
                if (ActivityPub\Transmitter::archivedInbox($inbox)) {
-                       Logger::info('Inbox is archived', ['cmd' => $cmd, 'inbox' => $inbox, 'id' => $item_id, 'uid' => $uid]);
+                       Logger::info('Inbox is archived', ['cmd' => $cmd, 'inbox' => $inbox, 'id' => $item_id, 'uri-id' => $uri_id, 'uid' => $uid]);
                        if (in_array($cmd, [Delivery::POST])) {
-                               $item = Post::selectFirst(['uri-id'], ['id' => $item_id]);
-                               Post\DeliveryData::incrementQueueFailed($item['uri-id'] ?? 0);
+                               if (empty($uri_id)) {
+                                       $item = Post::selectFirst(['uri-id'], ['id' => $item_id]);
+                                       $uri_id = $item['uri-id'] ?? 0;
+                               }
+                               Post\Delivery::remove($uri_id, $inbox);
+                               Post\DeliveryData::incrementQueueFailed($uri_id);
                        }
                        return;
                }