aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-19 14:44:20 +0200
committerChocobozzz <me@florianbigard.com>2018-09-19 15:22:55 +0200
commite587e0ecee5bec43a225995948faaa4bc97f080a (patch)
tree6348e28eb06086d0c8586ceb91230b4a4af67053 /server/helpers
parentd4defe07d26013a75577b30608841fe3f8334308 (diff)
downloadPeerTube-e587e0ecee5bec43a225995948faaa4bc97f080a.tar.gz
PeerTube-e587e0ecee5bec43a225995948faaa4bc97f080a.tar.zst
PeerTube-e587e0ecee5bec43a225995948faaa4bc97f080a.zip
Optimize activity actor load in AP processors
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/actor.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/server/helpers/actor.ts b/server/helpers/actor.ts
new file mode 100644
index 000000000..12a7ace9f
--- /dev/null
+++ b/server/helpers/actor.ts
@@ -0,0 +1,13 @@
1import { ActorModel } from '../models/activitypub/actor'
2
3type ActorFetchByUrlType = 'all' | 'actor-and-association-ids'
4function fetchActorByUrl (url: string, fetchType: ActorFetchByUrlType) {
5 if (fetchType === 'all') return ActorModel.loadByUrlAndPopulateAccountAndChannel(url)
6
7 if (fetchType === 'actor-and-association-ids') return ActorModel.loadByUrl(url)
8}
9
10export {
11 ActorFetchByUrlType,
12 fetchActorByUrl
13}