From 06a124338a0fb8e86bd835bc9fbae340652a7352 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 31 Jul 2022 08:10:47 +0000 Subject: [PATCH] Only store the inbox-queue on activated background processing --- src/Protocol/ActivityPub/Processor.php | 7 +++++-- src/Protocol/ActivityPub/Receiver.php | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index e3e2e295a..96308ca2c 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -311,7 +311,9 @@ class Processor $result = self::fetchMissingActivity($activity['reply-to-id'], $activity, '', Receiver::COMPLETION_AUTO); if (empty($result) && self::isActivityGone($activity['reply-to-id'])) { // Recursively delete this and all depending entries - Queue::deleteById($activity['entry-id']); + if (!empty($activity['entry-id'])) { + Queue::deleteById($activity['entry-id']); + } return []; } $fetch_by_worker = empty($result); @@ -366,9 +368,10 @@ class Processor if (!empty($activity['raw'])) { $item['source'] = $activity['raw']; - $item['protocol'] = Conversation::PARCEL_ACTIVITYPUB; } + $item['protocol'] = Conversation::PARCEL_ACTIVITYPUB; + if (isset($activity['push'])) { $item['direction'] = $activity['push'] ? Conversation::PUSH : Conversation::PULL; } diff --git a/src/Protocol/ActivityPub/Receiver.php b/src/Protocol/ActivityPub/Receiver.php index 2231d0acb..1d337f28a 100644 --- a/src/Protocol/ActivityPub/Receiver.php +++ b/src/Protocol/ActivityPub/Receiver.php @@ -583,7 +583,7 @@ class Receiver $object_data['object_activity'] = $activity; } - if ($trust_source || DI::config()->get('debug', 'ap_inbox_store_untrusted')) { + if (DI::config()->get('system', 'decoupled_receiver') && ($trust_source || DI::config()->get('debug', 'ap_inbox_store_untrusted'))) { $object_data = Queue::add($object_data, $type, $uid, $http_signer, $push, $trust_source); }