[PLUGIN][ActivityPub][Util][Explorer] Simplify fetching Actor by URI
This commit is contained in:
@@ -46,6 +46,7 @@ use DateTimeInterface;
|
||||
use InvalidArgumentException;
|
||||
use Plugin\ActivityPub\ActivityPub;
|
||||
use Plugin\ActivityPub\Entity\ActivitypubActivity;
|
||||
use Plugin\ActivityPub\Util\Explorer;
|
||||
use Plugin\ActivityPub\Util\Model;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
@@ -84,7 +85,7 @@ class Activity extends Model
|
||||
}
|
||||
|
||||
// Find Actor and Object
|
||||
$actor = ActivityPub::getActorByUri($type_activity->get('actor'));
|
||||
$actor = Explorer::getOneFromUri($type_activity->get('actor'));
|
||||
$type_object = $type_activity->get('object');
|
||||
if (\is_string($type_object)) { // Retrieve it
|
||||
$type_object = ActivityPub::getObjectByUri($type_object, try_online: true);
|
||||
|
||||
@@ -139,7 +139,7 @@ class Note extends Model
|
||||
}
|
||||
|
||||
if (\is_null($actor_id)) {
|
||||
$actor = ActivityPub::getActorByUri($type_note->get('attributedTo'));
|
||||
$actor = Explorer::getOneFromUri($type_note->get('attributedTo'));
|
||||
$actor_id = $actor->getId();
|
||||
}
|
||||
$map = [
|
||||
@@ -190,8 +190,8 @@ class Note extends Model
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
$actor = ActivityPub::getActorByUri($target);
|
||||
$object_mentions_ids[$actor->getId()] = $target;
|
||||
$actor = Explorer::getOneFromUri($target);
|
||||
$attention_ids[$actor->getId()] = $target;
|
||||
// If $to is a group and note is unlisted, set note's scope as Group
|
||||
if ($actor->isGroup() && $map['scope'] === 'unlisted') {
|
||||
$map['scope'] = VisibilityScope::GROUP;
|
||||
@@ -211,8 +211,8 @@ class Note extends Model
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
$actor = ActivityPub::getActorByUri($target);
|
||||
$object_mentions_ids[$actor->getId()] = $target;
|
||||
$actor = Explorer::getOneFromUri($target);
|
||||
$attention_ids[$actor->getId()] = $target;
|
||||
} catch (Exception $e) {
|
||||
Log::debug('ActivityPub->Model->Note->fromJson->getActorByUri', [$e]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user