Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix deleting a video with comments

Chocobozzz29c6b829446a
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts
index 868d04ff9e..ab0f05d6e5 100644
--- a/server/models/video/video-comment.ts
+++ b/server/models/video/video-comment.ts
@@ -188,6 +188,27 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
}) 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)
}