aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/models/video/video.ts24
-rw-r--r--server/types/models/video/video.ts7
2 files changed, 16 insertions, 15 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index b3543ddf2..9d89efa5b 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -783,21 +783,20 @@ export class VideoModel extends Model {
783 783
784 @BeforeDestroy 784 @BeforeDestroy
785 static async sendDelete (instance: MVideoAccountLight, options) { 785 static async sendDelete (instance: MVideoAccountLight, options) {
786 if (instance.isOwned()) { 786 if (!instance.isOwned()) return undefined
787 if (!instance.VideoChannel) {
788 instance.VideoChannel = await instance.$get('VideoChannel', {
789 include: [
790 ActorModel,
791 AccountModel
792 ],
793 transaction: options.transaction
794 }) as MChannelAccountDefault
795 }
796 787
797 return sendDeleteVideo(instance, options.transaction) 788 // Lazy load channels
789 if (!instance.VideoChannel) {
790 instance.VideoChannel = await instance.$get('VideoChannel', {
791 include: [
792 ActorModel,
793 AccountModel
794 ],
795 transaction: options.transaction
796 }) as MChannelAccountDefault
798 } 797 }
799 798
800 return undefined 799 return sendDeleteVideo(instance, options.transaction)
801 } 800 }
802 801
803 @BeforeDestroy 802 @BeforeDestroy
@@ -862,6 +861,7 @@ export class VideoModel extends Model {
862 861
863 logger.info('Saving video abuses details of video %s.', instance.url) 862 logger.info('Saving video abuses details of video %s.', instance.url)
864 863
864 if (!instance.Trackers) instance.Trackers = await instance.$get('Trackers', { transaction: options.transaction })
865 const details = instance.toFormattedDetailsJSON() 865 const details = instance.toFormattedDetailsJSON()
866 866
867 for (const abuse of instance.VideoAbuses) { 867 for (const abuse of instance.VideoAbuses) {
diff --git a/server/types/models/video/video.ts b/server/types/models/video/video.ts
index 5225fbce5..16ddaf740 100644
--- a/server/types/models/video/video.ts
+++ b/server/types/models/video/video.ts
@@ -32,7 +32,7 @@ type Use<K extends keyof VideoModel, M> = PickWith<VideoModel, K, M>
32export type MVideo = 32export type MVideo =
33 Omit<VideoModel, 'VideoChannel' | 'Tags' | 'Thumbnails' | 'VideoPlaylistElements' | 'VideoAbuses' | 33 Omit<VideoModel, 'VideoChannel' | 'Tags' | 'Thumbnails' | 'VideoPlaylistElements' | 'VideoAbuses' |
34 'VideoFiles' | 'VideoStreamingPlaylists' | 'VideoShares' | 'AccountVideoRates' | 'VideoComments' | 'VideoViews' | 'UserVideoHistories' | 34 'VideoFiles' | 'VideoStreamingPlaylists' | 'VideoShares' | 'AccountVideoRates' | 'VideoComments' | 'VideoViews' | 'UserVideoHistories' |
35 'ScheduleVideoUpdate' | 'VideoBlacklist' | 'VideoImport' | 'VideoCaptions' | 'VideoLive'> 35 'ScheduleVideoUpdate' | 'VideoBlacklist' | 'VideoImport' | 'VideoCaptions' | 'VideoLive' | 'Trackers'>
36 36
37// ############################################################################ 37// ############################################################################
38 38
@@ -186,7 +186,8 @@ export type MVideoDetails =
186 Use<'Thumbnails', MThumbnail[]> & 186 Use<'Thumbnails', MThumbnail[]> &
187 Use<'UserVideoHistories', MUserVideoHistoryTime[]> & 187 Use<'UserVideoHistories', MUserVideoHistoryTime[]> &
188 Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundancies[]> & 188 Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundancies[]> &
189 Use<'VideoFiles', MVideoFileRedundanciesOpt[]> 189 Use<'VideoFiles', MVideoFileRedundanciesOpt[]> &
190 Use<'Trackers', MTrackerUrl[]>
190 191
191export type MVideoForUser = 192export type MVideoForUser =
192 MVideo & 193 MVideo &
@@ -217,4 +218,4 @@ export type MVideoFormattableDetails =
217 Use<'Tags', MTag[]> & 218 Use<'Tags', MTag[]> &
218 Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesOpt[]> & 219 Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesOpt[]> &
219 Use<'VideoFiles', MVideoFileRedundanciesOpt[]> & 220 Use<'VideoFiles', MVideoFileRedundanciesOpt[]> &
220 Use<'Trackers', MTrackerUrl[]> 221 PickWithOpt<VideoModel, 'Trackers', MTrackerUrl[]>