Add item_by_link hook to allow connectors to import remote posts

This commit is contained in:
Hypolite Petovan 2021-11-23 17:47:02 -05:00
parent a47830990a
commit 39c763ce2f
2 changed files with 23 additions and 0 deletions

View file

@ -3262,6 +3262,18 @@ class Item
return $item_id;
}
$hookData = [
'uri' => $uri,
'uid' => $uid,
'item_id' => null,
];
Hook::callAll('item_by_link', $hookData);
if (isset($hookData['item_id'])) {
return is_numeric($hookData['item_id']) ? $hookData['item_id'] : 0;
}
if ($fetched_uri = ActivityPub\Processor::fetchMissingActivity($uri)) {
$item_id = self::searchByLink($fetched_uri, $uid);
} else {