diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-19 14:44:20 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-19 15:22:55 +0200 |
commit | e587e0ecee5bec43a225995948faaa4bc97f080a (patch) | |
tree | 6348e28eb06086d0c8586ceb91230b4a4af67053 /server/helpers | |
parent | d4defe07d26013a75577b30608841fe3f8334308 (diff) | |
download | PeerTube-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.ts | 13 |
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 @@ | |||
1 | import { ActorModel } from '../models/activitypub/actor' | ||
2 | |||
3 | type ActorFetchByUrlType = 'all' | 'actor-and-association-ids' | ||
4 | function 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 | |||
10 | export { | ||
11 | ActorFetchByUrlType, | ||
12 | fetchActorByUrl | ||
13 | } | ||