mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 10:49:28 +02:00
Refactor getOrCreateAPVideo
This commit is contained in:
parent
c56faf0d94
commit
304a84d59c
19 changed files with 243 additions and 209 deletions
|
@ -12,7 +12,7 @@ import { createOrUpdateCacheFile } from '../cache-file'
|
|||
import { createOrUpdateVideoPlaylist } from '../playlist'
|
||||
import { forwardVideoRelatedActivity } from '../send/utils'
|
||||
import { resolveThread } from '../video-comments'
|
||||
import { getOrCreateVideoAndAccountAndChannel } from '../videos'
|
||||
import { getOrCreateAPVideo } from '../videos'
|
||||
import { isBlockedByServerOrAccount } from '@server/lib/blocklist'
|
||||
|
||||
async function processCreateActivity (options: APProcessorOptions<ActivityCreate>) {
|
||||
|
@ -55,7 +55,7 @@ async function processCreateVideo (activity: ActivityCreate, notify: boolean) {
|
|||
const videoToCreateData = activity.object as VideoObject
|
||||
|
||||
const syncParam = { likes: false, dislikes: false, shares: false, comments: false, thumbnail: true, refreshVideo: false }
|
||||
const { video, created } = await getOrCreateVideoAndAccountAndChannel({ videoObject: videoToCreateData, syncParam })
|
||||
const { video, created } = await getOrCreateAPVideo({ videoObject: videoToCreateData, syncParam })
|
||||
|
||||
if (created && notify) Notifier.Instance.notifyOnNewVideoIfNeeded(video)
|
||||
|
||||
|
@ -67,7 +67,7 @@ async function processCreateCacheFile (activity: ActivityCreate, byActor: MActor
|
|||
|
||||
const cacheFile = activity.object as CacheFileObject
|
||||
|
||||
const { video } = await getOrCreateVideoAndAccountAndChannel({ videoObject: cacheFile.object })
|
||||
const { video } = await getOrCreateAPVideo({ videoObject: cacheFile.object })
|
||||
|
||||
await sequelizeTypescript.transaction(async t => {
|
||||
return createOrUpdateCacheFile(cacheFile, video, byActor, t)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue