X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Factivitypub%2Factors%2Fget.ts;h=de93aa9643f70689a20cd1a85e23175c3921d282;hb=28dfb44b145c537aba07ae73cb1287f25532022a;hp=e7e87a96740451c77365ce734f30efb1fee3bd01;hpb=10363c74c1d869f0e0c7bc4d0367b1f34d1bb6a4;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/activitypub/actors/get.ts b/server/lib/activitypub/actors/get.ts index e7e87a967..de93aa964 100644 --- a/server/lib/activitypub/actors/get.ts +++ b/server/lib/activitypub/actors/get.ts @@ -3,7 +3,7 @@ import { checkUrlsSameHost, getAPId } from '@server/helpers/activitypub' import { retryTransactionWrapper } from '@server/helpers/database-utils' import { logger } from '@server/helpers/logger' import { JobQueue } from '@server/lib/job-queue' -import { ActorFetchByUrlType, fetchActorByUrl } from '@server/lib/model-loaders' +import { ActorLoadByUrlType, loadActorByUrl } from '@server/lib/model-loaders' import { MActor, MActorAccountChannelId, MActorAccountChannelIdActor, MActorAccountId, MActorFullActor } from '@server/types/models' import { ActivityPubActor } from '@shared/models' import { refreshActorIfNeeded } from './refresh' @@ -25,7 +25,7 @@ function getOrCreateAPActor ( async function getOrCreateAPActor ( activityActor: string | ActivityPubActor, - fetchType: ActorFetchByUrlType = 'association-ids', + fetchType: ActorLoadByUrlType = 'association-ids', recurseIfNeeded = true, updateCollections = false ): Promise { @@ -56,7 +56,7 @@ async function getOrCreateAPActor ( if (actor.Account) (actor as MActorAccountChannelIdActor).Account.Actor = actor if (actor.VideoChannel) (actor as MActorAccountChannelIdActor).VideoChannel.Actor = actor - const { actor: actorRefreshed, refreshed } = await retryTransactionWrapper(refreshActorIfNeeded, actor, fetchType) + const { actor: actorRefreshed, refreshed } = await refreshActorIfNeeded(actor, fetchType) if (!actorRefreshed) throw new Error('Actor ' + actor.url + ' does not exist anymore.') await scheduleOutboxFetchIfNeeded(actor, created, refreshed, updateCollections) @@ -73,8 +73,8 @@ export { // --------------------------------------------------------------------------- -async function loadActorFromDB (actorUrl: string, fetchType: ActorFetchByUrlType) { - let actor = await fetchActorByUrl(actorUrl, fetchType) +async function loadActorFromDB (actorUrl: string, fetchType: ActorLoadByUrlType) { + let actor = await loadActorByUrl(actorUrl, fetchType) // Orphan actor (not associated to an account of channel) so recreate it if (actor && (!actor.Account && !actor.VideoChannel)) {