Fix abuse tests

This commit is contained in:
Chocobozzz 2021-03-09 16:10:52 +01:00
parent c221d62a8b
commit 42ec411bf8
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 16 additions and 15 deletions

View File

@ -783,7 +783,9 @@ export class VideoModel extends Model {
@BeforeDestroy
static async sendDelete (instance: MVideoAccountLight, options) {
if (instance.isOwned()) {
if (!instance.isOwned()) return undefined
// Lazy load channels
if (!instance.VideoChannel) {
instance.VideoChannel = await instance.$get('VideoChannel', {
include: [
@ -797,9 +799,6 @@ export class VideoModel extends Model {
return sendDeleteVideo(instance, options.transaction)
}
return undefined
}
@BeforeDestroy
static async removeFiles (instance: VideoModel) {
const tasks: Promise<any>[] = []
@ -862,6 +861,7 @@ export class VideoModel extends Model {
logger.info('Saving video abuses details of video %s.', instance.url)
if (!instance.Trackers) instance.Trackers = await instance.$get('Trackers', { transaction: options.transaction })
const details = instance.toFormattedDetailsJSON()
for (const abuse of instance.VideoAbuses) {

View File

@ -32,7 +32,7 @@ type Use<K extends keyof VideoModel, M> = PickWith<VideoModel, K, M>
export type MVideo =
Omit<VideoModel, 'VideoChannel' | 'Tags' | 'Thumbnails' | 'VideoPlaylistElements' | 'VideoAbuses' |
'VideoFiles' | 'VideoStreamingPlaylists' | 'VideoShares' | 'AccountVideoRates' | 'VideoComments' | 'VideoViews' | 'UserVideoHistories' |
'ScheduleVideoUpdate' | 'VideoBlacklist' | 'VideoImport' | 'VideoCaptions' | 'VideoLive'>
'ScheduleVideoUpdate' | 'VideoBlacklist' | 'VideoImport' | 'VideoCaptions' | 'VideoLive' | 'Trackers'>
// ############################################################################
@ -186,7 +186,8 @@ export type MVideoDetails =
Use<'Thumbnails', MThumbnail[]> &
Use<'UserVideoHistories', MUserVideoHistoryTime[]> &
Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundancies[]> &
Use<'VideoFiles', MVideoFileRedundanciesOpt[]>
Use<'VideoFiles', MVideoFileRedundanciesOpt[]> &
Use<'Trackers', MTrackerUrl[]>
export type MVideoForUser =
MVideo &
@ -217,4 +218,4 @@ export type MVideoFormattableDetails =
Use<'Tags', MTag[]> &
Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesOpt[]> &
Use<'VideoFiles', MVideoFileRedundanciesOpt[]> &
Use<'Trackers', MTrackerUrl[]>
PickWithOpt<VideoModel, 'Trackers', MTrackerUrl[]>