1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 10:49:28 +02:00

Optimize activity actor load in AP processors

This commit is contained in:
Chocobozzz 2018-09-19 14:44:20 +02:00
parent d4defe07d2
commit e587e0ecee
No known key found for this signature in database
GPG key ID: 583A612D890159BE
16 changed files with 110 additions and 89 deletions

View file

@ -1,15 +1,11 @@
import { ActivityAccept } from '../../../../shared/models/activitypub'
import { getActorUrl } from '../../../helpers/activitypub'
import { ActorModel } from '../../../models/activitypub/actor'
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
import { addFetchOutboxJob } from '../actor'
async function processAcceptActivity (activity: ActivityAccept, inboxActor?: ActorModel) {
async function processAcceptActivity (activity: ActivityAccept, targetActor: ActorModel, inboxActor?: ActorModel) {
if (inboxActor === undefined) throw new Error('Need to accept on explicit inbox.')
const actorUrl = getActorUrl(activity.actor)
const targetActor = await ActorModel.loadByUrl(actorUrl)
return processAccept(inboxActor, targetActor)
}