[PLUGIN][ActivityPub][FreeNetwork] DB::findBy won't work if not commited first

This commit is contained in:
Diogo Peralta Cordeiro 2022-02-20 13:59:06 +00:00
parent 8b0e9c7890
commit 1e310aa124
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0

View File

@ -382,7 +382,7 @@ class ActivityPub extends Plugin
{ {
try { try {
if (FreeNetworkActorProtocol::canIAddr('activitypub', $addr = Discovery::normalize($target))) { if (FreeNetworkActorProtocol::canIAddr('activitypub', $addr = Discovery::normalize($target))) {
$ap_actor = ActivitypubActor::getByAddr($addr); $ap_actor = DB::wrapInTransaction(fn() => ActivitypubActor::getByAddr($addr));
$actor = Actor::getById($ap_actor->getActorId()); $actor = Actor::getById($ap_actor->getActorId());
FreeNetworkActorProtocol::protocolSucceeded('activitypub', $actor->getId(), $addr); FreeNetworkActorProtocol::protocolSucceeded('activitypub', $actor->getId(), $addr);
return Event::stop; return Event::stop;
@ -390,7 +390,7 @@ class ActivityPub extends Plugin
return Event::next; return Event::next;
} }
} catch (Exception $e) { } catch (Exception $e) {
Log::error('ActivityPub Webfinger Mention check failed.', [$e]); Log::error('ActivityPub WebFinger Mention check failed.', [$e]);
return Event::next; return Event::next;
} }
} }