From f37dc0dd14d9ce0b59c454c2c1b935fcbe9727e9 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 23 Aug 2018 17:58:39 +0200 Subject: Add ability to search video channels --- server/lib/activitypub/process/process-update.ts | 4 ++-- server/lib/activitypub/videos.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'server/lib/activitypub') 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' import { ActorModel } from '../../../models/activitypub/actor' import { VideoChannelModel } from '../../../models/video/video-channel' import { fetchAvatarIfExists, getOrCreateActorAndServerAndModel, updateActorAvatarInstance, updateActorInstance } from '../actor' -import { getOrCreateVideoAndAccountAndChannel, getOrCreateVideoChannel, updateVideoFromAP } from '../videos' +import { getOrCreateVideoAndAccountAndChannel, getOrCreateVideoChannelFromVideoObject, updateVideoFromAP } from '../videos' import { sanitizeAndCheckVideoTorrentObject } from '../../../helpers/custom-validators/activitypub/videos' async function processUpdateActivity (activity: ActivityUpdate) { @@ -40,7 +40,7 @@ async function processUpdateVideo (actor: ActorModel, activity: ActivityUpdate) } const { video } = await getOrCreateVideoAndAccountAndChannel(videoObject.id) - const channelActor = await getOrCreateVideoChannel(videoObject) + const channelActor = await getOrCreateVideoChannelFromVideoObject(videoObject) return updateVideoFromAP(video, videoObject, actor, channelActor, activity.to) } 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 return attributes } -function getOrCreateVideoChannel (videoObject: VideoTorrentObject) { +function getOrCreateVideoChannelFromVideoObject (videoObject: VideoTorrentObject) { const channel = videoObject.attributedTo.find(a => a.type === 'Group') if (!channel) throw new Error('Cannot find associated video channel to video ' + videoObject.url) @@ -251,7 +251,7 @@ async function getOrCreateVideoAndAccountAndChannel ( const { videoObject: fetchedVideo } = await fetchRemoteVideo(videoUrl) if (!fetchedVideo) throw new Error('Cannot fetch remote video with url: ' + videoUrl) - const channelActor = await getOrCreateVideoChannel(fetchedVideo) + const channelActor = await getOrCreateVideoChannelFromVideoObject(fetchedVideo) const video = await retryTransactionWrapper(createVideo, fetchedVideo, channelActor, syncParam.thumbnail) // Process outside the transaction because we could fetch remote data @@ -329,7 +329,7 @@ async function refreshVideoIfNeeded (video: VideoModel): Promise { return video } - const channelActor = await getOrCreateVideoChannel(videoObject) + const channelActor = await getOrCreateVideoChannelFromVideoObject(videoObject) const account = await AccountModel.load(channelActor.VideoChannel.accountId) return updateVideoFromAP(video, videoObject, account.Actor, channelActor) @@ -440,7 +440,7 @@ export { videoActivityObjectToDBAttributes, videoFileActivityUrlToDBAttributes, createVideo, - getOrCreateVideoChannel, + getOrCreateVideoChannelFromVideoObject, addVideoShares, createRates } -- cgit v1.2.3