diff options
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r-- | server/lib/activitypub/process/process-update.ts | 4 | ||||
-rw-r--r-- | server/lib/activitypub/videos.ts | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/server/lib/activitypub/process/process-update.ts b/server/lib/activitypub/process/process-update.ts index 07a5ff92f..d2ad738a2 100644 --- a/server/lib/activitypub/process/process-update.ts +++ b/server/lib/activitypub/process/process-update.ts | |||
@@ -7,7 +7,7 @@ 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, getOrCreateActorAndServerAndModel, updateActorAvatarInstance, updateActorInstance } from '../actor' |
10 | import { getOrCreateVideoAndAccountAndChannel, getOrCreateVideoChannel, updateVideoFromAP } 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 | 12 | ||
13 | async function processUpdateActivity (activity: ActivityUpdate) { | 13 | async function processUpdateActivity (activity: ActivityUpdate) { |
@@ -40,7 +40,7 @@ async function processUpdateVideo (actor: ActorModel, activity: ActivityUpdate) | |||
40 | } | 40 | } |
41 | 41 | ||
42 | const { video } = await getOrCreateVideoAndAccountAndChannel(videoObject.id) | 42 | const { video } = await getOrCreateVideoAndAccountAndChannel(videoObject.id) |
43 | const channelActor = await getOrCreateVideoChannel(videoObject) | 43 | const channelActor = await getOrCreateVideoChannelFromVideoObject(videoObject) |
44 | 44 | ||
45 | return updateVideoFromAP(video, videoObject, actor, channelActor, activity.to) | 45 | return updateVideoFromAP(video, videoObject, actor, channelActor, activity.to) |
46 | } | 46 | } |
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index 388c31fe5..6c2095897 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts | |||
@@ -174,7 +174,7 @@ function videoFileActivityUrlToDBAttributes (videoCreated: VideoModel, videoObje | |||
174 | return attributes | 174 | return attributes |
175 | } | 175 | } |
176 | 176 | ||
177 | function getOrCreateVideoChannel (videoObject: VideoTorrentObject) { | 177 | function getOrCreateVideoChannelFromVideoObject (videoObject: VideoTorrentObject) { |
178 | const channel = videoObject.attributedTo.find(a => a.type === 'Group') | 178 | const channel = videoObject.attributedTo.find(a => a.type === 'Group') |
179 | if (!channel) throw new Error('Cannot find associated video channel to video ' + videoObject.url) | 179 | if (!channel) throw new Error('Cannot find associated video channel to video ' + videoObject.url) |
180 | 180 | ||
@@ -251,7 +251,7 @@ async function getOrCreateVideoAndAccountAndChannel ( | |||
251 | const { videoObject: fetchedVideo } = await fetchRemoteVideo(videoUrl) | 251 | const { videoObject: fetchedVideo } = await fetchRemoteVideo(videoUrl) |
252 | if (!fetchedVideo) throw new Error('Cannot fetch remote video with url: ' + videoUrl) | 252 | if (!fetchedVideo) throw new Error('Cannot fetch remote video with url: ' + videoUrl) |
253 | 253 | ||
254 | const channelActor = await getOrCreateVideoChannel(fetchedVideo) | 254 | const channelActor = await getOrCreateVideoChannelFromVideoObject(fetchedVideo) |
255 | const video = await retryTransactionWrapper(createVideo, fetchedVideo, channelActor, syncParam.thumbnail) | 255 | const video = await retryTransactionWrapper(createVideo, fetchedVideo, channelActor, syncParam.thumbnail) |
256 | 256 | ||
257 | // Process outside the transaction because we could fetch remote data | 257 | // Process outside the transaction because we could fetch remote data |
@@ -329,7 +329,7 @@ async function refreshVideoIfNeeded (video: VideoModel): Promise<VideoModel> { | |||
329 | return video | 329 | return video |
330 | } | 330 | } |
331 | 331 | ||
332 | const channelActor = await getOrCreateVideoChannel(videoObject) | 332 | const channelActor = await getOrCreateVideoChannelFromVideoObject(videoObject) |
333 | const account = await AccountModel.load(channelActor.VideoChannel.accountId) | 333 | const account = await AccountModel.load(channelActor.VideoChannel.accountId) |
334 | return updateVideoFromAP(video, videoObject, account.Actor, channelActor) | 334 | return updateVideoFromAP(video, videoObject, account.Actor, channelActor) |
335 | 335 | ||
@@ -440,7 +440,7 @@ export { | |||
440 | videoActivityObjectToDBAttributes, | 440 | videoActivityObjectToDBAttributes, |
441 | videoFileActivityUrlToDBAttributes, | 441 | videoFileActivityUrlToDBAttributes, |
442 | createVideo, | 442 | createVideo, |
443 | getOrCreateVideoChannel, | 443 | getOrCreateVideoChannelFromVideoObject, |
444 | addVideoShares, | 444 | addVideoShares, |
445 | createRates | 445 | createRates |
446 | } | 446 | } |