use Friendica\Content\Text\HTML;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
+use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\APContact;
$item['network'] = Protocol::ACTIVITYPUB;
$item['author-link'] = $activity['author'];
- $item['author-id'] = Contact::getIdForURL($activity['author'], 0, false);
+ $item['author-id'] = Contact::getIdForURL($activity['author']);
$item['owner-link'] = $activity['actor'];
- $item['owner-id'] = Contact::getIdForURL($activity['actor'], 0, false);
+ $item['owner-id'] = Contact::getIdForURL($activity['actor']);
if (in_array(0, $activity['receiver']) && !empty($activity['unlisted'])) {
$item['private'] = Item::UNLISTED;
DBA::close($items);
if (count($original) != count($receivers)) {
- Logger::info('Improved data', ['id' => $activity['id'], 'object' => $activity['object_id'], 'original' => $original, 'improved' => $receivers]);
+ Logger::info('Improved data', ['id' => $activity['id'], 'object' => $activity['object_id'], 'original' => $original, 'improved' => $receivers, 'callstack' => System::callstack()]);
}
return $receivers;
$item['uid'] = $receiver;
+ $type = $activity['reception_type'][$receiver] ?? Receiver::TARGET_UNKNOWN;
+ switch($type) {
+ case Receiver::TARGET_TO:
+ $item['post-type'] = Item::PT_TO;
+ break;
+ case Receiver::TARGET_CC:
+ $item['post-type'] = Item::PT_CC;
+ break;
+ case Receiver::TARGET_BTO:
+ $item['post-type'] = Item::PT_BTO;
+ break;
+ case Receiver::TARGET_BCC:
+ $item['post-type'] = Item::PT_BCC;
+ break;
+ case Receiver::TARGET_FOLLOWER:
+ $item['post-type'] = Item::PT_FOLLOWER;
+ break;
+ case Receiver::TARGET_ANSWER:
+ $item['post-type'] = Item::PT_COMMENT;
+ break;
+ default:
+ $item['post-type'] = Item::PT_ARTICLE;
+ }
+
if ($item['isForum'] ?? false) {
- $item['contact-id'] = Contact::getIdForURL($activity['actor'], $receiver, false);
+ $item['contact-id'] = Contact::getIdForURL($activity['actor'], $receiver);
} else {
- $item['contact-id'] = Contact::getIdForURL($activity['author'], $receiver, false);
+ $item['contact-id'] = Contact::getIdForURL($activity['author'], $receiver);
}
if (($receiver != 0) && empty($item['contact-id'])) {
- $item['contact-id'] = Contact::getIdForURL($activity['author'], 0, false);
+ $item['contact-id'] = Contact::getIdForURL($activity['author']);
}
if (!empty($activity['directmessage'])) {
* @return string fetched message URL
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function fetchMissingActivity($url, $child = [])
+ public static function fetchMissingActivity(string $url, array $child = [])
{
if (!empty($child['receiver'])) {
$uid = ActivityPub\Receiver::getFirstUserFromReceivers($child['receiver']);
}
$owner = User::getOwnerDataById($uid);
+ if (empty($owner)) {
+ return;
+ }
$cid = Contact::getIdForURL($activity['actor'], $uid);
if (!empty($cid)) {
}
Logger::info('Updating profile', ['object' => $activity['object_id']]);
- Contact::updateFromProbeByURL($activity['object_id'], true);
+ Contact::updateFromProbeByURL($activity['object_id']);
}
/**
}
$owner = User::getOwnerDataById($uid);
+ if (empty($owner)) {
+ return;
+ }
$cid = Contact::getIdForURL($activity['actor'], $uid);
if (empty($cid)) {