use Friendica\Model\Contact;
use Friendica\Model\APContact;
use Friendica\Model\Item;
+use Friendica\Model\Post;
use Friendica\Model\User;
use Friendica\Protocol\Activity;
use Friendica\Protocol\ActivityPub;
$actor = JsonLD::fetchElement($ldactivity, 'as:actor', '@id');
$apcontact = APContact::getByURL($actor);
- if (!empty($apcontact) && ($apcontact['type'] == 'Application') && ($apcontact['nick'] == 'relay')) {
+ if (empty($apcontact)) {
+ Logger::notice('Unable to retrieve AP contact for actor', ['actor' => $actor]);
+ } elseif ($apcontact['type'] == 'Application' && $apcontact['nick'] == 'relay') {
self::processRelayPost($ldactivity, $actor);
return;
+ } else {
+ APContact::unmarkForArchival($apcontact);
}
$http_signer = HTTPSignature::getSigner($body, $header);
}
}
- if (Item::exists(['uri' => $object_id, 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]])) {
+ if (Post::exists(['uri' => $object_id, 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]])) {
// We just assume "note" since it doesn't make a difference for the further processing
return 'as:Note';
}
$profile = APContact::getByURL($object_id);
if (!empty($profile['type'])) {
+ APContact::unmarkForArchival($profile);
return 'as:' . $profile['type'];
}
$object_data['author'] = JsonLD::fetchElement($activity, 'as:actor', '@id');
$object_data['object_id'] = $object_id;
$object_data['object_type'] = ''; // Since we don't fetch the object, we don't know the type
+ $object_data['push'] = $push;
} elseif (in_array($type, ['as:Add'])) {
$object_data = [];
$object_data['id'] = JsonLD::fetchElement($activity, '@id');
$object_data['object_id'] = JsonLD::fetchElement($activity, 'as:object', '@id');
$object_data['object_type'] = JsonLD::fetchElement($activity['as:object'], '@type');
$object_data['object_content'] = JsonLD::fetchElement($activity['as:object'], 'as:content', '@type');
+ $object_data['push'] = $push;
} else {
$object_data = [];
$object_data['id'] = JsonLD::fetchElement($activity, '@id');
$object_data['object_actor'] = JsonLD::fetchElement($activity['as:object'], 'as:actor', '@id');
$object_data['object_object'] = JsonLD::fetchElement($activity['as:object'], 'as:object');
$object_data['object_type'] = JsonLD::fetchElement($activity['as:object'], '@type');
+ $object_data['push'] = $push;
// An Undo is done on the object of an object, so we need that type as well
if (($type == 'as:Undo') && !empty($object_data['object_object'])) {
}
if (!empty($reply)) {
- $parents = Item::select(['uid'], ['uri' => $reply]);
- while ($parent = Item::fetch($parents)) {
+ $parents = Post::select(['uid'], ['uri' => $reply]);
+ while ($parent = Post::fetch($parents)) {
$receivers[$parent['uid']] = ['uid' => $parent['uid'], 'type' => self::TARGET_ANSWER];
}
+ DBA::close($parents);
}
if (!empty($actor)) {
} else {
Logger::log('Empty content for ' . $object_id . ', check if content is available locally.', Logger::DEBUG);
- $item = Item::selectFirst([], ['uri' => $object_id]);
+ $item = Post::selectFirst([], ['uri' => $object_id]);
if (!DBA::isResult($item)) {
Logger::log('Object with url ' . $object_id . ' was not found locally.', Logger::DEBUG);
return false;