diff options
Diffstat (limited to 'server/lib/activitypub/process/process-update.ts')
-rw-r--r-- | server/lib/activitypub/process/process-update.ts | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/server/lib/activitypub/process/process-update.ts b/server/lib/activitypub/process/process-update.ts index 0bceb370e..ed3489ebf 100644 --- a/server/lib/activitypub/process/process-update.ts +++ b/server/lib/activitypub/process/process-update.ts | |||
@@ -6,27 +6,30 @@ import { sequelizeTypescript } from '../../../initializers' | |||
6 | import { AccountModel } from '../../../models/account/account' | 6 | import { AccountModel } from '../../../models/account/account' |
7 | import { ActorModel } from '../../../models/activitypub/actor' | 7 | import { ActorModel } from '../../../models/activitypub/actor' |
8 | import { VideoChannelModel } from '../../../models/video/video-channel' | 8 | import { VideoChannelModel } from '../../../models/video/video-channel' |
9 | import { fetchAvatarIfExists, getOrCreateActorAndServerAndModel, updateActorAvatarInstance, updateActorInstance } from '../actor' | 9 | import { fetchAvatarIfExists, updateActorAvatarInstance, updateActorInstance } from '../actor' |
10 | import { getOrCreateVideoAndAccountAndChannel, updateVideoFromAP, getOrCreateVideoChannelFromVideoObject } from '../videos' | 10 | import { getOrCreateVideoAndAccountAndChannel, getOrCreateVideoChannelFromVideoObject, updateVideoFromAP } from '../videos' |
11 | import { sanitizeAndCheckVideoTorrentObject } from '../../../helpers/custom-validators/activitypub/videos' | 11 | import { sanitizeAndCheckVideoTorrentObject } from '../../../helpers/custom-validators/activitypub/videos' |
12 | import { isCacheFileObjectValid } from '../../../helpers/custom-validators/activitypub/cache-file' | 12 | import { isCacheFileObjectValid } from '../../../helpers/custom-validators/activitypub/cache-file' |
13 | import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy' | 13 | import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy' |
14 | import { createCacheFile, updateCacheFile } from '../cache-file' | 14 | import { createCacheFile, updateCacheFile } from '../cache-file' |
15 | 15 | ||
16 | async function processUpdateActivity (activity: ActivityUpdate) { | 16 | async function processUpdateActivity (activity: ActivityUpdate, byActor: ActorModel) { |
17 | const actor = await getOrCreateActorAndServerAndModel(activity.actor) | ||
18 | const objectType = activity.object.type | 17 | const objectType = activity.object.type |
19 | 18 | ||
20 | if (objectType === 'Video') { | 19 | if (objectType === 'Video') { |
21 | return retryTransactionWrapper(processUpdateVideo, actor, activity) | 20 | return retryTransactionWrapper(processUpdateVideo, byActor, activity) |
22 | } | 21 | } |
23 | 22 | ||
24 | if (objectType === 'Person' || objectType === 'Application' || objectType === 'Group') { | 23 | if (objectType === 'Person' || objectType === 'Application' || objectType === 'Group') { |
25 | return retryTransactionWrapper(processUpdateActor, actor, activity) | 24 | // We need more attributes |
25 | const byActorFull = await ActorModel.loadByUrlAndPopulateAccountAndChannel(byActor.url) | ||
26 | return retryTransactionWrapper(processUpdateActor, byActorFull, activity) | ||
26 | } | 27 | } |
27 | 28 | ||
28 | if (objectType === 'CacheFile') { | 29 | if (objectType === 'CacheFile') { |
29 | return retryTransactionWrapper(processUpdateCacheFile, actor, activity) | 30 | // We need more attributes |
31 | const byActorFull = await ActorModel.loadByUrlAndPopulateAccountAndChannel(byActor.url) | ||
32 | return retryTransactionWrapper(processUpdateCacheFile, byActorFull, activity) | ||
30 | } | 33 | } |
31 | 34 | ||
32 | return undefined | 35 | return undefined |