+ if ($type == 'as:Announce') {
+ $object_data['object_activity'] = $activity;
+ }
+
+ if ($trust_source || DI::config()->get('debug', 'ap_inbox_store_untrusted')) {
+ $object_data = Queue::add($object_data, $type, $uid, $http_signer, $push, $trust_source);
+ }
+
+ if (!$trust_source) {
+ Logger::info('Activity trust could not be achieved.', ['id' => $object_data['object_id'], 'type' => $type, 'signer' => $signer, 'actor' => $actor, 'attributedTo' => $attributed_to]);
+ return;
+ }
+
+ if (!empty($activity['recursion-depth'])) {
+ $object_data['recursion-depth'] = $activity['recursion-depth'];
+ }
+
+ if (in_array('as:Question', [$object_data['object_type'] ?? '', $object_data['object_object_type'] ?? ''])) {
+ self::storeUnhandledActivity(false, $type, $object_data, $activity, $body, $uid, $trust_source, $push, $signer);
+ }
+
+ if (!self::routeActivities($object_data, $type, $push)) {
+ self::storeUnhandledActivity(true, $type, $object_data, $activity, $body, $uid, $trust_source, $push, $signer);
+ Queue::remove($object_data);
+ }
+ }
+
+ /**
+ * Route activities
+ *
+ * @param array $object_data
+ * @param string $type
+ * @param boolean $push
+ *
+ * @return boolean Could the activity be routed?
+ */
+ public static function routeActivities(array $object_data, string $type, bool $push): bool
+ {
+ $activity = $object_data['object_activity'] ?? [];
+