diff options
author | Chocobozzz <me@florianbigard.com> | 2021-03-09 16:10:52 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-03-09 16:10:52 +0100 |
commit | 42ec411bf879ef9505b93f74610d787320643193 (patch) | |
tree | acc33c404e66857bd4bb04e962ace50f4f1d3503 /server/models/video | |
parent | c221d62a8b5b8775fd7d737d1f79a0b764261f18 (diff) | |
download | PeerTube-42ec411bf879ef9505b93f74610d787320643193.tar.gz PeerTube-42ec411bf879ef9505b93f74610d787320643193.tar.zst PeerTube-42ec411bf879ef9505b93f74610d787320643193.zip |
Fix abuse tests
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video.ts | 24 |
1 files changed, 12 insertions, 12 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) { |