From 45199b498d4f958206c8de9226fc990545308bda Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 22 Mar 2022 12:28:47 +0000 Subject: [PATCH] Prevent further processing of incoming posts when thay are rejected --- src/Protocol/ActivityPub/Processor.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index 5651343cb5..4399de191a 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -164,6 +164,10 @@ class Processor if (!DBA::isResult($item)) { Logger::warning('No existing item, item will be created', ['uri' => $activity['id']]); $item = self::createItem($activity); + if (empty($item)) { + return; + } + self::postItem($activity, $item); return; } @@ -416,6 +420,10 @@ class Processor public static function createActivity($activity, $verb) { $item = self::createItem($activity); + if (empty($item)) { + return; + } + $item['verb'] = $verb; $item['thr-parent'] = $activity['object_id']; $item['gravity'] = GRAVITY_ACTIVITY; @@ -584,6 +592,7 @@ class Processor // The checks are split to improve the support when searching why a message was accepted. if (count($activity['receiver']) != 1) { // The message has more than one receiver, so it is wanted. + if (!isset($item['uri-id'])) Logger::info('Blubb', ['callstack' => System::callstack(20), 'receiver' => $activity['receiver']]); Logger::debug('Message has got several receivers - accepted', ['uri-id' => $item['uri-id'], 'guid' => $item['guid'], 'url' => $item['uri']]); return true; }