mirror of https://github.com/Chocobozzz/PeerTube
Fix abuse tests
parent
c221d62a8b
commit
42ec411bf8
|
@ -783,21 +783,20 @@ export class VideoModel extends Model {
|
|||
|
||||
@BeforeDestroy
|
||||
static async sendDelete (instance: MVideoAccountLight, options) {
|
||||
if (instance.isOwned()) {
|
||||
if (!instance.VideoChannel) {
|
||||
instance.VideoChannel = await instance.$get('VideoChannel', {
|
||||
include: [
|
||||
ActorModel,
|
||||
AccountModel
|
||||
],
|
||||
transaction: options.transaction
|
||||
}) as MChannelAccountDefault
|
||||
}
|
||||
if (!instance.isOwned()) return undefined
|
||||
|
||||
return sendDeleteVideo(instance, options.transaction)
|
||||
// Lazy load channels
|
||||
if (!instance.VideoChannel) {
|
||||
instance.VideoChannel = await instance.$get('VideoChannel', {
|
||||
include: [
|
||||
ActorModel,
|
||||
AccountModel
|
||||
],
|
||||
transaction: options.transaction
|
||||
}) as MChannelAccountDefault
|
||||
}
|
||||
|
||||
return undefined
|
||||
return sendDeleteVideo(instance, options.transaction)
|
||||
}
|
||||
|
||||
@BeforeDestroy
|
||||
|
@ -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) {
|
||||
|
|
|
@ -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[]>
|
||||
|
|
Loading…
Reference in New Issue