[PLUGIN][ActivityPub][Model][Activity] Sometimes we don't have a local, move on with encapsulated
This commit is contained in:
parent
8808195a80
commit
03f449035a
|
@ -36,6 +36,7 @@ use ActivityPhp\Type;
|
||||||
use ActivityPhp\Type\AbstractObject;
|
use ActivityPhp\Type\AbstractObject;
|
||||||
use App\Core\DB\DB;
|
use App\Core\DB\DB;
|
||||||
use App\Core\Event;
|
use App\Core\Event;
|
||||||
|
use App\Core\Log;
|
||||||
use App\Core\Router\Router;
|
use App\Core\Router\Router;
|
||||||
use App\Entity\Activity as GSActivity;
|
use App\Entity\Activity as GSActivity;
|
||||||
use App\Util\Exception\ClientException;
|
use App\Util\Exception\ClientException;
|
||||||
|
@ -43,6 +44,7 @@ use App\Util\Exception\NoSuchActorException;
|
||||||
use App\Util\Exception\NotFoundException;
|
use App\Util\Exception\NotFoundException;
|
||||||
use App\Util\Exception\NotImplementedException;
|
use App\Util\Exception\NotImplementedException;
|
||||||
use DateTimeInterface;
|
use DateTimeInterface;
|
||||||
|
use Exception;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use const JSON_UNESCAPED_SLASHES;
|
use const JSON_UNESCAPED_SLASHES;
|
||||||
use Plugin\ActivityPub\ActivityPub;
|
use Plugin\ActivityPub\ActivityPub;
|
||||||
|
@ -92,7 +94,12 @@ class Activity extends Model
|
||||||
$type_object = ActivityPub::getObjectByUri($type_object, try_online: true);
|
$type_object = ActivityPub::getObjectByUri($type_object, try_online: true);
|
||||||
} else { // Encapsulated, if we have it locally, prefer it
|
} else { // Encapsulated, if we have it locally, prefer it
|
||||||
// TODO: Test authority of activity over object
|
// TODO: Test authority of activity over object
|
||||||
$type_object = ActivityPub::getObjectByUri($type_object->get('id'), try_online: false) ?? $type_object;
|
try {
|
||||||
|
$type_object = ActivityPub::getObjectByUri($type_object->get('id'), try_online: false);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
// Use the encapsulated then
|
||||||
|
Log::debug('Failed to find a local activity, will continue with encapsulated.', [$e]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($type_object instanceof Type\AbstractObject)) { // It's a new object apparently
|
if (($type_object instanceof Type\AbstractObject)) { // It's a new object apparently
|
||||||
|
|
Loading…
Reference in New Issue
Block a user