aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/process/process-update.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/activitypub/process/process-update.ts')
-rw-r--r--server/lib/activitypub/process/process-update.ts11
1 files changed, 2 insertions, 9 deletions
diff --git a/server/lib/activitypub/process/process-update.ts b/server/lib/activitypub/process/process-update.ts
index e092a6729..bd4013555 100644
--- a/server/lib/activitypub/process/process-update.ts
+++ b/server/lib/activitypub/process/process-update.ts
@@ -10,8 +10,7 @@ import { fetchAvatarIfExists, updateActorAvatarInstance, updateActorInstance } f
10import { getOrCreateVideoAndAccountAndChannel, getOrCreateVideoChannelFromVideoObject, updateVideoFromAP } from '../videos' 10import { getOrCreateVideoAndAccountAndChannel, getOrCreateVideoChannelFromVideoObject, updateVideoFromAP } from '../videos'
11import { sanitizeAndCheckVideoTorrentObject } from '../../../helpers/custom-validators/activitypub/videos' 11import { sanitizeAndCheckVideoTorrentObject } from '../../../helpers/custom-validators/activitypub/videos'
12import { isCacheFileObjectValid } from '../../../helpers/custom-validators/activitypub/cache-file' 12import { isCacheFileObjectValid } from '../../../helpers/custom-validators/activitypub/cache-file'
13import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy' 13import { createOrUpdateCacheFile } from '../cache-file'
14import { createCacheFile, updateCacheFile } from '../cache-file'
15import { forwardVideoRelatedActivity } from '../send/utils' 14import { forwardVideoRelatedActivity } from '../send/utils'
16 15
17async function processUpdateActivity (activity: ActivityUpdate, byActor: ActorModel) { 16async function processUpdateActivity (activity: ActivityUpdate, byActor: ActorModel) {
@@ -77,13 +76,7 @@ async function processUpdateCacheFile (byActor: ActorModel, activity: ActivityUp
77 const { video } = await getOrCreateVideoAndAccountAndChannel({ videoObject: cacheFileObject.object }) 76 const { video } = await getOrCreateVideoAndAccountAndChannel({ videoObject: cacheFileObject.object })
78 77
79 await sequelizeTypescript.transaction(async t => { 78 await sequelizeTypescript.transaction(async t => {
80 const redundancyModel = await VideoRedundancyModel.loadByUrl(cacheFileObject.id, t) 79 await createOrUpdateCacheFile(cacheFileObject, video, byActor, t)
81
82 if (!redundancyModel) {
83 await createCacheFile(cacheFileObject, video, byActor, t)
84 } else {
85 await updateCacheFile(cacheFileObject, redundancyModel, video, byActor, t)
86 }
87 }) 80 })
88 81
89 if (video.isOwned()) { 82 if (video.isOwned()) {