diff options
Diffstat (limited to 'server/lib/activitypub/process/process-update.ts')
-rw-r--r-- | server/lib/activitypub/process/process-update.ts | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/server/lib/activitypub/process/process-update.ts b/server/lib/activitypub/process/process-update.ts index 2c094f7ca..a5431c76b 100644 --- a/server/lib/activitypub/process/process-update.ts +++ b/server/lib/activitypub/process/process-update.ts | |||
@@ -9,10 +9,9 @@ import { sequelizeTypescript } from '../../../initializers' | |||
9 | import { AccountModel } from '../../../models/account/account' | 9 | import { AccountModel } from '../../../models/account/account' |
10 | import { ActorModel } from '../../../models/activitypub/actor' | 10 | import { ActorModel } from '../../../models/activitypub/actor' |
11 | import { TagModel } from '../../../models/video/tag' | 11 | import { TagModel } from '../../../models/video/tag' |
12 | import { VideoModel } from '../../../models/video/video' | ||
13 | import { VideoFileModel } from '../../../models/video/video-file' | 12 | import { VideoFileModel } from '../../../models/video/video-file' |
14 | import { fetchAvatarIfExists, getOrCreateActorAndServerAndModel, updateActorAvatarInstance, updateActorInstance } from '../actor' | 13 | import { fetchAvatarIfExists, getOrCreateActorAndServerAndModel, updateActorAvatarInstance, updateActorInstance } from '../actor' |
15 | import { videoActivityObjectToDBAttributes, videoFileActivityUrlToDBAttributes } from './misc' | 14 | import { getOrCreateAccountAndVideoAndChannel, videoActivityObjectToDBAttributes, videoFileActivityUrlToDBAttributes } from '../videos' |
16 | 15 | ||
17 | async function processUpdateActivity (activity: ActivityUpdate) { | 16 | async function processUpdateActivity (activity: ActivityUpdate) { |
18 | const actor = await getOrCreateActorAndServerAndModel(activity.actor) | 17 | const actor = await getOrCreateActorAndServerAndModel(activity.actor) |
@@ -46,8 +45,10 @@ function processUpdateVideo (actor: ActorModel, activity: ActivityUpdate) { | |||
46 | async function updateRemoteVideo (actor: ActorModel, activity: ActivityUpdate) { | 45 | async function updateRemoteVideo (actor: ActorModel, activity: ActivityUpdate) { |
47 | const videoAttributesToUpdate = activity.object as VideoTorrentObject | 46 | const videoAttributesToUpdate = activity.object as VideoTorrentObject |
48 | 47 | ||
48 | const res = await getOrCreateAccountAndVideoAndChannel(videoAttributesToUpdate.id) | ||
49 | |||
49 | logger.debug('Updating remote video "%s".', videoAttributesToUpdate.uuid) | 50 | logger.debug('Updating remote video "%s".', videoAttributesToUpdate.uuid) |
50 | let videoInstance: VideoModel | 51 | let videoInstance = res.video |
51 | let videoFieldsSave: any | 52 | let videoFieldsSave: any |
52 | 53 | ||
53 | try { | 54 | try { |
@@ -56,9 +57,6 @@ async function updateRemoteVideo (actor: ActorModel, activity: ActivityUpdate) { | |||
56 | transaction: t | 57 | transaction: t |
57 | } | 58 | } |
58 | 59 | ||
59 | const videoInstance = await VideoModel.loadByUrlAndPopulateAccount(videoAttributesToUpdate.id, t) | ||
60 | if (!videoInstance) throw new Error('Video ' + videoAttributesToUpdate.id + ' not found.') | ||
61 | |||
62 | videoFieldsSave = videoInstance.toJSON() | 60 | videoFieldsSave = videoInstance.toJSON() |
63 | 61 | ||
64 | const videoChannel = videoInstance.VideoChannel | 62 | const videoChannel = videoInstance.VideoChannel |