From e82ef8890b60da42e47b8a4439309f7311e05141 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 3 Aug 2022 05:14:07 +0000 Subject: [PATCH] Only process entries for existing posts --- src/Protocol/ActivityPub/Processor.php | 2 +- src/Protocol/ActivityPub/Queue.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index 73f414d73c..d58628ff2a 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -1050,7 +1050,7 @@ class Processor Queue::remove($activity); - if ($success && Queue::hasChildren($item['uri'])) { + if ($success && Queue::hasChildren($item['uri']) && Post::exists(['uri' => $item['uri']])) { Queue::processReplyByUri($item['uri']); } diff --git a/src/Protocol/ActivityPub/Queue.php b/src/Protocol/ActivityPub/Queue.php index 98c3b4d497..2fa95897c6 100644 --- a/src/Protocol/ActivityPub/Queue.php +++ b/src/Protocol/ActivityPub/Queue.php @@ -25,6 +25,7 @@ use Friendica\Core\Logger; use Friendica\Database\Database; use Friendica\Database\DBA; use Friendica\DI; +use Friendica\Model\Post; use Friendica\Util\DateTimeFormat; use Friendica\Util\JsonLD; @@ -232,6 +233,10 @@ class Queue { $entries = DBA::select('inbox-entry', ['id', 'type', 'object-type', 'object-id', 'in-reply-to-id'], ["`trust` AND `wid` IS NULL"], ['order' => ['id' => true]]); while ($entry = DBA::fetch($entries)) { + // Don't process entries of items that are answer to non existing posts + if (!empty($entry['in-reply-to-id']) && !Post::exists(['uri' => $entry['in-reply-to-id']])) { + continue; + } // We don't need to process entries that depend on already existing entries. if (!empty($entry['in-reply-to-id']) && DBA::exists('inbox-entry', ["`id` != ? AND `object-id` = ?", $entry['id'], $entry['in-reply-to-id']])) { continue; -- 2.39.5