+ public static function isProcessable(int $id): bool
+ {
+ $entry = DBA::selectFirst('inbox-entry', [], ['id' => $id]);
+ if (empty($entry)) {
+ return false;
+ }
+
+ if (!empty($entry['object-id']) && Post::exists(['uri' => $entry['object-id']])) {
+ // The object already exists, so processing can be done
+ return true;
+ }
+
+ if (!empty($entry['conversation'])) {
+ $conv_id = ItemURI::getIdByURI($entry['conversation'], false);
+ if (DBA::exists('post-thread', ['conversation-id' => $conv_id])) {
+ // We have got the conversation in the system, so the post can be processed
+ return true;
+ }
+ }
+
+ if (!empty($entry['object-id']) && !empty($entry['in-reply-to-id']) && ($entry['object-id'] != $entry['in-reply-to-id']) && DBA::exists('inbox-entry', ['object-id' => $entry['in-reply-to-id']])) {
+ // This entry belongs to some other entry that should be processed first
+ return false;
+ }
+
+ return true;
+ }
+