From 29c6b829446a6fb29dffc6b7b638079ce60f3771 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 13 Feb 2018 13:35:10 +0100 Subject: [PATCH] Fix deleting a video with comments --- server/models/video/video-comment.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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) } -- 2.25.1