From: Chocobozzz Date: Tue, 13 Feb 2018 12:35:10 +0000 (+0100) Subject: Fix deleting a video with comments X-Git-Tag: v0.0.24-alpha~21 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=29c6b829446a6fb29dffc6b7b638079ce60f3771;p=oweals%2Fpeertube.git Fix deleting a video with comments --- diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts index 868d04ff9..ab0f05d6e 100644 --- a/server/models/video/video-comment.ts +++ b/server/models/video/video-comment.ts @@ -188,6 +188,27 @@ export class VideoCommentModel extends Model { }) as AccountModel } + if (!instance.Video) { + instance.Video = await instance.$get('Video', { + include: [ + { + model: VideoChannelModel, + include: [ + { + model: AccountModel, + include: [ + { + model: ActorModel + } + ] + } + ] + } + ], + transaction: options.transaction + }) as VideoModel + } + if (instance.isOwned()) { await sendDeleteVideoComment(instance, options.transaction) }