diff options
author | Chocobozzz <me@florianbigard.com> | 2022-06-28 14:57:51 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-06-28 15:06:15 +0200 |
commit | 4fae2b1f300c1f027629569817262f60873a663a (patch) | |
tree | fabffae6d39aa13b19985f8c92730db2a721dceb /server/lib | |
parent | 4c8336af67bf4e570e227d5cb1fbcb7a53b3776e (diff) | |
download | PeerTube-4fae2b1f300c1f027629569817262f60873a663a.tar.gz PeerTube-4fae2b1f300c1f027629569817262f60873a663a.tar.zst PeerTube-4fae2b1f300c1f027629569817262f60873a663a.zip |
Rename video full loading
Diffstat (limited to 'server/lib')
21 files changed, 28 insertions, 28 deletions
diff --git a/server/lib/activitypub/process/process-dislike.ts b/server/lib/activitypub/process/process-dislike.ts index 97a994e94..44e349b22 100644 --- a/server/lib/activitypub/process/process-dislike.ts +++ b/server/lib/activitypub/process/process-dislike.ts | |||
@@ -35,7 +35,7 @@ async function processDislike (activity: ActivityCreate | ActivityDislike, byAct | |||
35 | if (!onlyVideo.isOwned()) return | 35 | if (!onlyVideo.isOwned()) return |
36 | 36 | ||
37 | return sequelizeTypescript.transaction(async t => { | 37 | return sequelizeTypescript.transaction(async t => { |
38 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(onlyVideo.id, t) | 38 | const video = await VideoModel.loadFull(onlyVideo.id, t) |
39 | 39 | ||
40 | const existingRate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byAccount.id, video.id, activity.id, t) | 40 | const existingRate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byAccount.id, video.id, activity.id, t) |
41 | if (existingRate && existingRate.type === 'dislike') return | 41 | if (existingRate && existingRate.type === 'dislike') return |
diff --git a/server/lib/activitypub/process/process-like.ts b/server/lib/activitypub/process/process-like.ts index 1aee756d8..580a05bcd 100644 --- a/server/lib/activitypub/process/process-like.ts +++ b/server/lib/activitypub/process/process-like.ts | |||
@@ -34,7 +34,7 @@ async function processLikeVideo (byActor: MActorSignature, activity: ActivityLik | |||
34 | if (!onlyVideo.isOwned()) return | 34 | if (!onlyVideo.isOwned()) return |
35 | 35 | ||
36 | return sequelizeTypescript.transaction(async t => { | 36 | return sequelizeTypescript.transaction(async t => { |
37 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(onlyVideo.id, t) | 37 | const video = await VideoModel.loadFull(onlyVideo.id, t) |
38 | 38 | ||
39 | const existingRate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byAccount.id, video.id, activity.id, t) | 39 | const existingRate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byAccount.id, video.id, activity.id, t) |
40 | if (existingRate && existingRate.type === 'like') return | 40 | if (existingRate && existingRate.type === 'like') return |
diff --git a/server/lib/activitypub/process/process-undo.ts b/server/lib/activitypub/process/process-undo.ts index 257eb6c2b..778a38e05 100644 --- a/server/lib/activitypub/process/process-undo.ts +++ b/server/lib/activitypub/process/process-undo.ts | |||
@@ -63,7 +63,7 @@ async function processUndoLike (byActor: MActorSignature, activity: ActivityUndo | |||
63 | return sequelizeTypescript.transaction(async t => { | 63 | return sequelizeTypescript.transaction(async t => { |
64 | if (!byActor.Account) throw new Error('Unknown account ' + byActor.url) | 64 | if (!byActor.Account) throw new Error('Unknown account ' + byActor.url) |
65 | 65 | ||
66 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(onlyVideo.id, t) | 66 | const video = await VideoModel.loadFull(onlyVideo.id, t) |
67 | const rate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byActor.Account.id, video.id, likeActivity.id, t) | 67 | const rate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byActor.Account.id, video.id, likeActivity.id, t) |
68 | if (!rate || rate.type !== 'like') throw new Error(`Unknown like by account ${byActor.Account.id} for video ${video.id}.`) | 68 | if (!rate || rate.type !== 'like') throw new Error(`Unknown like by account ${byActor.Account.id} for video ${video.id}.`) |
69 | 69 | ||
@@ -87,7 +87,7 @@ async function processUndoDislike (byActor: MActorSignature, activity: ActivityU | |||
87 | return sequelizeTypescript.transaction(async t => { | 87 | return sequelizeTypescript.transaction(async t => { |
88 | if (!byActor.Account) throw new Error('Unknown account ' + byActor.url) | 88 | if (!byActor.Account) throw new Error('Unknown account ' + byActor.url) |
89 | 89 | ||
90 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(onlyVideo.id, t) | 90 | const video = await VideoModel.loadFull(onlyVideo.id, t) |
91 | const rate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byActor.Account.id, video.id, dislike.id, t) | 91 | const rate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byActor.Account.id, video.id, dislike.id, t) |
92 | if (!rate || rate.type !== 'dislike') throw new Error(`Unknown dislike by account ${byActor.Account.id} for video ${video.id}.`) | 92 | if (!rate || rate.type !== 'dislike') throw new Error(`Unknown dislike by account ${byActor.Account.id} for video ${video.id}.`) |
93 | 93 | ||
diff --git a/server/lib/activitypub/send/send-undo.ts b/server/lib/activitypub/send/send-undo.ts index 442178c42..b8eb47ff6 100644 --- a/server/lib/activitypub/send/send-undo.ts +++ b/server/lib/activitypub/send/send-undo.ts | |||
@@ -83,7 +83,7 @@ async function sendUndoCacheFile (byActor: MActor, redundancyModel: MVideoRedund | |||
83 | return | 83 | return |
84 | } | 84 | } |
85 | 85 | ||
86 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(associatedVideo.id) | 86 | const video = await VideoModel.loadFull(associatedVideo.id) |
87 | const createActivity = buildCreateActivity(redundancyModel.url, byActor, redundancyModel.toActivityPubObject()) | 87 | const createActivity = buildCreateActivity(redundancyModel.url, byActor, redundancyModel.toActivityPubObject()) |
88 | 88 | ||
89 | return sendUndoVideoRelatedActivity({ | 89 | return sendUndoVideoRelatedActivity({ |
diff --git a/server/lib/activitypub/send/send-update.ts b/server/lib/activitypub/send/send-update.ts index 3577ece02..24983dd19 100644 --- a/server/lib/activitypub/send/send-update.ts +++ b/server/lib/activitypub/send/send-update.ts | |||
@@ -92,7 +92,7 @@ async function sendUpdateCacheFile (byActor: MActorLight, redundancyModel: MVide | |||
92 | return | 92 | return |
93 | } | 93 | } |
94 | 94 | ||
95 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(associatedVideo.id) | 95 | const video = await VideoModel.loadFull(associatedVideo.id) |
96 | 96 | ||
97 | const activityBuilder = (audience: ActivityAudience) => { | 97 | const activityBuilder = (audience: ActivityAudience) => { |
98 | const redundancyObject = redundancyModel.toActivityPubObject() | 98 | const redundancyObject = redundancyModel.toActivityPubObject() |
diff --git a/server/lib/files-cache/videos-caption-cache.ts b/server/lib/files-cache/videos-caption-cache.ts index 58e2260b6..2927c37eb 100644 --- a/server/lib/files-cache/videos-caption-cache.ts +++ b/server/lib/files-cache/videos-caption-cache.ts | |||
@@ -35,7 +35,7 @@ class VideosCaptionCache extends AbstractVideoStaticFileCache <string> { | |||
35 | if (videoCaption.isOwned()) throw new Error('Cannot load remote caption of owned video.') | 35 | if (videoCaption.isOwned()) throw new Error('Cannot load remote caption of owned video.') |
36 | 36 | ||
37 | // Used to fetch the path | 37 | // Used to fetch the path |
38 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(videoCaption.videoId) | 38 | const video = await VideoModel.loadFull(videoCaption.videoId) |
39 | if (!video) return undefined | 39 | if (!video) return undefined |
40 | 40 | ||
41 | const remoteUrl = videoCaption.getFileUrl(video) | 41 | const remoteUrl = videoCaption.getFileUrl(video) |
diff --git a/server/lib/files-cache/videos-preview-cache.ts b/server/lib/files-cache/videos-preview-cache.ts index dd3a84aca..b7a8d6105 100644 --- a/server/lib/files-cache/videos-preview-cache.ts +++ b/server/lib/files-cache/videos-preview-cache.ts | |||
@@ -30,7 +30,7 @@ class VideosPreviewCache extends AbstractVideoStaticFileCache <string> { | |||
30 | 30 | ||
31 | // Key is the video UUID | 31 | // Key is the video UUID |
32 | protected async loadRemoteFile (key: string) { | 32 | protected async loadRemoteFile (key: string) { |
33 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(key) | 33 | const video = await VideoModel.loadFull(key) |
34 | if (!video) return undefined | 34 | if (!video) return undefined |
35 | 35 | ||
36 | if (video.isOwned()) throw new Error('Cannot load remote preview of owned video.') | 36 | if (video.isOwned()) throw new Error('Cannot load remote preview of owned video.') |
diff --git a/server/lib/files-cache/videos-torrent-cache.ts b/server/lib/files-cache/videos-torrent-cache.ts index 23217f140..c8188b79f 100644 --- a/server/lib/files-cache/videos-torrent-cache.ts +++ b/server/lib/files-cache/videos-torrent-cache.ts | |||
@@ -40,7 +40,7 @@ class VideosTorrentCache extends AbstractVideoStaticFileCache <string> { | |||
40 | if (file.getVideo().isOwned()) throw new Error('Cannot load remote file of owned video.') | 40 | if (file.getVideo().isOwned()) throw new Error('Cannot load remote file of owned video.') |
41 | 41 | ||
42 | // Used to fetch the path | 42 | // Used to fetch the path |
43 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(file.getVideo().id) | 43 | const video = await VideoModel.loadFull(file.getVideo().id) |
44 | if (!video) return undefined | 44 | if (!video) return undefined |
45 | 45 | ||
46 | const remoteUrl = file.getRemoteTorrentUrl(video) | 46 | const remoteUrl = file.getRemoteTorrentUrl(video) |
diff --git a/server/lib/job-queue/handlers/activitypub-http-fetcher.ts b/server/lib/job-queue/handlers/activitypub-http-fetcher.ts index 128e14f94..de533de6c 100644 --- a/server/lib/job-queue/handlers/activitypub-http-fetcher.ts +++ b/server/lib/job-queue/handlers/activitypub-http-fetcher.ts | |||
@@ -17,7 +17,7 @@ async function processActivityPubHttpFetcher (job: Job) { | |||
17 | const payload = job.data as ActivitypubHttpFetcherPayload | 17 | const payload = job.data as ActivitypubHttpFetcherPayload |
18 | 18 | ||
19 | let video: MVideoFullLight | 19 | let video: MVideoFullLight |
20 | if (payload.videoId) video = await VideoModel.loadAndPopulateAccountAndServerAndTags(payload.videoId) | 20 | if (payload.videoId) video = await VideoModel.loadFull(payload.videoId) |
21 | 21 | ||
22 | const fetcherType: { [ id in FetchType ]: (items: any[]) => Promise<any> } = { | 22 | const fetcherType: { [ id in FetchType ]: (items: any[]) => Promise<any> } = { |
23 | 'activity': items => processActivities(items, { outboxUrl: payload.uri, fromFetch: true }), | 23 | 'activity': items => processActivities(items, { outboxUrl: payload.uri, fromFetch: true }), |
diff --git a/server/lib/job-queue/handlers/video-file-import.ts b/server/lib/job-queue/handlers/video-file-import.ts index 110176d81..1c600e2a7 100644 --- a/server/lib/job-queue/handlers/video-file-import.ts +++ b/server/lib/job-queue/handlers/video-file-import.ts | |||
@@ -18,7 +18,7 @@ async function processVideoFileImport (job: Job) { | |||
18 | const payload = job.data as VideoFileImportPayload | 18 | const payload = job.data as VideoFileImportPayload |
19 | logger.info('Processing video file import in job %d.', job.id) | 19 | logger.info('Processing video file import in job %d.', job.id) |
20 | 20 | ||
21 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(payload.videoUUID) | 21 | const video = await VideoModel.loadFull(payload.videoUUID) |
22 | // No video, maybe deleted? | 22 | // No video, maybe deleted? |
23 | if (!video) { | 23 | if (!video) { |
24 | logger.info('Do not process job %d, video does not exist.', job.id) | 24 | logger.info('Do not process job %d, video does not exist.', job.id) |
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts index d59a1b12f..40804e82e 100644 --- a/server/lib/job-queue/handlers/video-import.ts +++ b/server/lib/job-queue/handlers/video-import.ts | |||
@@ -219,7 +219,7 @@ async function processFile (downloader: () => Promise<string>, videoImport: MVid | |||
219 | if (previewModel) await video.addAndSaveThumbnail(previewModel, t) | 219 | if (previewModel) await video.addAndSaveThumbnail(previewModel, t) |
220 | 220 | ||
221 | // Now we can federate the video (reload from database, we need more attributes) | 221 | // Now we can federate the video (reload from database, we need more attributes) |
222 | const videoForFederation = await VideoModel.loadAndPopulateAccountAndServerAndTags(video.uuid, t) | 222 | const videoForFederation = await VideoModel.loadFull(video.uuid, t) |
223 | await federateVideoIfNeeded(videoForFederation, true, t) | 223 | await federateVideoIfNeeded(videoForFederation, true, t) |
224 | 224 | ||
225 | // Update video import object | 225 | // Update video import object |
diff --git a/server/lib/job-queue/handlers/video-live-ending.ts b/server/lib/job-queue/handlers/video-live-ending.ts index b2c42664a..0e1bfb240 100644 --- a/server/lib/job-queue/handlers/video-live-ending.ts +++ b/server/lib/job-queue/handlers/video-live-ending.ts | |||
@@ -144,7 +144,7 @@ async function replaceLiveByReplay (options: { | |||
144 | await liveSession.save() | 144 | await liveSession.save() |
145 | 145 | ||
146 | // Remove old HLS playlist video files | 146 | // Remove old HLS playlist video files |
147 | const videoWithFiles = await VideoModel.loadAndPopulateAccountAndServerAndTags(liveVideo.id) | 147 | const videoWithFiles = await VideoModel.loadFull(liveVideo.id) |
148 | 148 | ||
149 | const hlsPlaylist = videoWithFiles.getHLSPlaylist() | 149 | const hlsPlaylist = videoWithFiles.getHLSPlaylist() |
150 | await VideoFileModel.removeHLSFilesOfVideoId(hlsPlaylist.id) | 150 | await VideoFileModel.removeHLSFilesOfVideoId(hlsPlaylist.id) |
@@ -241,7 +241,7 @@ async function cleanupLiveAndFederate (options: { | |||
241 | } | 241 | } |
242 | 242 | ||
243 | try { | 243 | try { |
244 | const fullVideo = await VideoModel.loadAndPopulateAccountAndServerAndTags(video.id) | 244 | const fullVideo = await VideoModel.loadFull(video.id) |
245 | return federateVideoIfNeeded(fullVideo, false, undefined) | 245 | return federateVideoIfNeeded(fullVideo, false, undefined) |
246 | } catch (err) { | 246 | } catch (err) { |
247 | logger.warn('Cannot federate live after cleanup', { videoId: video.id, err }) | 247 | logger.warn('Cannot federate live after cleanup', { videoId: video.id, err }) |
diff --git a/server/lib/job-queue/handlers/video-studio-edition.ts b/server/lib/job-queue/handlers/video-studio-edition.ts index cf3064a7a..434d0ffe8 100644 --- a/server/lib/job-queue/handlers/video-studio-edition.ts +++ b/server/lib/job-queue/handlers/video-studio-edition.ts | |||
@@ -44,7 +44,7 @@ async function processVideoStudioEdition (job: Job) { | |||
44 | 44 | ||
45 | logger.info('Process video studio edition of %s in job %d.', payload.videoUUID, job.id, lTags) | 45 | logger.info('Process video studio edition of %s in job %d.', payload.videoUUID, job.id, lTags) |
46 | 46 | ||
47 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(payload.videoUUID) | 47 | const video = await VideoModel.loadFull(payload.videoUUID) |
48 | 48 | ||
49 | // No video, maybe deleted? | 49 | // No video, maybe deleted? |
50 | if (!video) { | 50 | if (!video) { |
diff --git a/server/lib/job-queue/handlers/video-transcoding.ts b/server/lib/job-queue/handlers/video-transcoding.ts index 95ee6b384..5afca65ca 100644 --- a/server/lib/job-queue/handlers/video-transcoding.ts +++ b/server/lib/job-queue/handlers/video-transcoding.ts | |||
@@ -42,7 +42,7 @@ async function processVideoTranscoding (job: Job) { | |||
42 | const payload = job.data as VideoTranscodingPayload | 42 | const payload = job.data as VideoTranscodingPayload |
43 | logger.info('Processing transcoding job %d.', job.id, lTags(payload.videoUUID)) | 43 | logger.info('Processing transcoding job %d.', job.id, lTags(payload.videoUUID)) |
44 | 44 | ||
45 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(payload.videoUUID) | 45 | const video = await VideoModel.loadFull(payload.videoUUID) |
46 | // No video, maybe deleted? | 46 | // No video, maybe deleted? |
47 | if (!video) { | 47 | if (!video) { |
48 | logger.info('Do not process job %d, video does not exist.', job.id, lTags(payload.videoUUID)) | 48 | logger.info('Do not process job %d, video does not exist.', job.id, lTags(payload.videoUUID)) |
@@ -180,7 +180,7 @@ async function onVideoFirstWebTorrentTranscoding ( | |||
180 | const { resolution, isPortraitMode, audioStream } = await videoArg.probeMaxQualityFile() | 180 | const { resolution, isPortraitMode, audioStream } = await videoArg.probeMaxQualityFile() |
181 | 181 | ||
182 | // Maybe the video changed in database, refresh it | 182 | // Maybe the video changed in database, refresh it |
183 | const videoDatabase = await VideoModel.loadAndPopulateAccountAndServerAndTags(videoArg.uuid) | 183 | const videoDatabase = await VideoModel.loadFull(videoArg.uuid) |
184 | // Video does not exist anymore | 184 | // Video does not exist anymore |
185 | if (!videoDatabase) return undefined | 185 | if (!videoDatabase) return undefined |
186 | 186 | ||
diff --git a/server/lib/live/live-manager.ts b/server/lib/live/live-manager.ts index d499b4b1a..74f203091 100644 --- a/server/lib/live/live-manager.ts +++ b/server/lib/live/live-manager.ts | |||
@@ -351,7 +351,7 @@ class LiveManager { | |||
351 | const videoId = live.videoId | 351 | const videoId = live.videoId |
352 | 352 | ||
353 | try { | 353 | try { |
354 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(videoId) | 354 | const video = await VideoModel.loadFull(videoId) |
355 | 355 | ||
356 | logger.info('Will publish and federate live %s.', video.url, localLTags) | 356 | logger.info('Will publish and federate live %s.', video.url, localLTags) |
357 | 357 | ||
@@ -390,7 +390,7 @@ class LiveManager { | |||
390 | const { videoId, liveSession: liveSessionArg, cleanupNow = false } = options | 390 | const { videoId, liveSession: liveSessionArg, cleanupNow = false } = options |
391 | 391 | ||
392 | try { | 392 | try { |
393 | const fullVideo = await VideoModel.loadAndPopulateAccountAndServerAndTags(videoId) | 393 | const fullVideo = await VideoModel.loadFull(videoId) |
394 | if (!fullVideo) return | 394 | if (!fullVideo) return |
395 | 395 | ||
396 | const live = await VideoLiveModel.loadByVideoId(fullVideo.id) | 396 | const live = await VideoLiveModel.loadByVideoId(fullVideo.id) |
diff --git a/server/lib/model-loaders/video.ts b/server/lib/model-loaders/video.ts index 0a3c15ad8..cef6a367c 100644 --- a/server/lib/model-loaders/video.ts +++ b/server/lib/model-loaders/video.ts | |||
@@ -35,7 +35,7 @@ function loadVideo ( | |||
35 | ) | 35 | ) |
36 | } | 36 | } |
37 | 37 | ||
38 | if (fetchType === 'all') return VideoModel.loadAndPopulateAccountAndServerAndTags(id, undefined, userId) | 38 | if (fetchType === 'all') return VideoModel.loadFull(id, undefined, userId) |
39 | 39 | ||
40 | if (fetchType === 'only-immutable-attributes') return VideoModel.loadImmutableAttributes(id) | 40 | if (fetchType === 'only-immutable-attributes') return VideoModel.loadImmutableAttributes(id) |
41 | 41 | ||
diff --git a/server/lib/plugins/plugin-helpers-builder.ts b/server/lib/plugins/plugin-helpers-builder.ts index 897271c0b..b76c0a8a4 100644 --- a/server/lib/plugins/plugin-helpers-builder.ts +++ b/server/lib/plugins/plugin-helpers-builder.ts | |||
@@ -83,7 +83,7 @@ function buildVideosHelpers () { | |||
83 | 83 | ||
84 | removeVideo: (id: number) => { | 84 | removeVideo: (id: number) => { |
85 | return sequelizeTypescript.transaction(async t => { | 85 | return sequelizeTypescript.transaction(async t => { |
86 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(id, t) | 86 | const video = await VideoModel.loadFull(id, t) |
87 | 87 | ||
88 | await video.destroy({ transaction: t }) | 88 | await video.destroy({ transaction: t }) |
89 | }) | 89 | }) |
@@ -94,7 +94,7 @@ function buildVideosHelpers () { | |||
94 | }, | 94 | }, |
95 | 95 | ||
96 | getFiles: async (id: number | string) => { | 96 | getFiles: async (id: number | string) => { |
97 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(id) | 97 | const video = await VideoModel.loadFull(id) |
98 | if (!video) return undefined | 98 | if (!video) return undefined |
99 | 99 | ||
100 | const webtorrentVideoFiles = (video.VideoFiles || []).map(f => ({ | 100 | const webtorrentVideoFiles = (video.VideoFiles || []).map(f => ({ |
@@ -178,14 +178,14 @@ function buildModerationHelpers () { | |||
178 | }, | 178 | }, |
179 | 179 | ||
180 | blacklistVideo: async (options: { videoIdOrUUID: number | string, createOptions: VideoBlacklistCreate }) => { | 180 | blacklistVideo: async (options: { videoIdOrUUID: number | string, createOptions: VideoBlacklistCreate }) => { |
181 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(options.videoIdOrUUID) | 181 | const video = await VideoModel.loadFull(options.videoIdOrUUID) |
182 | if (!video) return | 182 | if (!video) return |
183 | 183 | ||
184 | await blacklistVideo(video, options.createOptions) | 184 | await blacklistVideo(video, options.createOptions) |
185 | }, | 185 | }, |
186 | 186 | ||
187 | unblacklistVideo: async (options: { videoIdOrUUID: number | string }) => { | 187 | unblacklistVideo: async (options: { videoIdOrUUID: number | string }) => { |
188 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(options.videoIdOrUUID) | 188 | const video = await VideoModel.loadFull(options.videoIdOrUUID) |
189 | if (!video) return | 189 | if (!video) return |
190 | 190 | ||
191 | const videoBlacklist = await VideoBlacklistModel.loadByVideoId(video.id) | 191 | const videoBlacklist = await VideoBlacklistModel.loadByVideoId(video.id) |
diff --git a/server/lib/schedulers/update-videos-scheduler.ts b/server/lib/schedulers/update-videos-scheduler.ts index c652682dd..5bfbc3cd2 100644 --- a/server/lib/schedulers/update-videos-scheduler.ts +++ b/server/lib/schedulers/update-videos-scheduler.ts | |||
@@ -30,7 +30,7 @@ export class UpdateVideosScheduler extends AbstractScheduler { | |||
30 | 30 | ||
31 | for (const schedule of schedules) { | 31 | for (const schedule of schedules) { |
32 | await sequelizeTypescript.transaction(async t => { | 32 | await sequelizeTypescript.transaction(async t => { |
33 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(schedule.videoId, t) | 33 | const video = await VideoModel.loadFull(schedule.videoId, t) |
34 | 34 | ||
35 | logger.info('Executing scheduled video update on %s.', video.uuid) | 35 | logger.info('Executing scheduled video update on %s.', video.uuid) |
36 | 36 | ||
diff --git a/server/lib/schedulers/video-views-buffer-scheduler.ts b/server/lib/schedulers/video-views-buffer-scheduler.ts index 937764155..244a88b14 100644 --- a/server/lib/schedulers/video-views-buffer-scheduler.ts +++ b/server/lib/schedulers/video-views-buffer-scheduler.ts | |||
@@ -26,7 +26,7 @@ export class VideoViewsBufferScheduler extends AbstractScheduler { | |||
26 | const views = await Redis.Instance.getLocalVideoViews(videoId) | 26 | const views = await Redis.Instance.getLocalVideoViews(videoId) |
27 | await Redis.Instance.deleteLocalVideoViews(videoId) | 27 | await Redis.Instance.deleteLocalVideoViews(videoId) |
28 | 28 | ||
29 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(videoId) | 29 | const video = await VideoModel.loadFull(videoId) |
30 | if (!video) { | 30 | if (!video) { |
31 | logger.debug('Video %d does not exist anymore, skipping videos view addition.', videoId, lTags()) | 31 | logger.debug('Video %d does not exist anymore, skipping videos view addition.', videoId, lTags()) |
32 | continue | 32 | continue |
diff --git a/server/lib/video-channel.ts b/server/lib/video-channel.ts index 2fd63a8c4..8322c9ad2 100644 --- a/server/lib/video-channel.ts +++ b/server/lib/video-channel.ts | |||
@@ -36,7 +36,7 @@ async function federateAllVideosOfChannel (videoChannel: MChannelId) { | |||
36 | const videoIds = await VideoModel.getAllIdsFromChannel(videoChannel) | 36 | const videoIds = await VideoModel.getAllIdsFromChannel(videoChannel) |
37 | 37 | ||
38 | for (const videoId of videoIds) { | 38 | for (const videoId of videoIds) { |
39 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(videoId) | 39 | const video = await VideoModel.loadFull(videoId) |
40 | 40 | ||
41 | await federateVideoIfNeeded(video, false) | 41 | await federateVideoIfNeeded(video, false) |
42 | } | 42 | } |
diff --git a/server/lib/video-state.ts b/server/lib/video-state.ts index ae2725d65..b4e3831e5 100644 --- a/server/lib/video-state.ts +++ b/server/lib/video-state.ts | |||
@@ -43,7 +43,7 @@ function moveToNextState (options: { | |||
43 | 43 | ||
44 | return sequelizeTypescript.transaction(async t => { | 44 | return sequelizeTypescript.transaction(async t => { |
45 | // Maybe the video changed in database, refresh it | 45 | // Maybe the video changed in database, refresh it |
46 | const videoDatabase = await VideoModel.loadAndPopulateAccountAndServerAndTags(video.uuid, t) | 46 | const videoDatabase = await VideoModel.loadFull(video.uuid, t) |
47 | // Video does not exist anymore | 47 | // Video does not exist anymore |
48 | if (!videoDatabase) return undefined | 48 | if (!videoDatabase) return undefined |
49 | 49 | ||