]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix deleting a video with comments
authorChocobozzz <me@florianbigard.com>
Tue, 13 Feb 2018 12:35:10 +0000 (13:35 +0100)
committerChocobozzz <me@florianbigard.com>
Tue, 13 Feb 2018 12:35:10 +0000 (13:35 +0100)
server/models/video/video-comment.ts

index 868d04ff9e0a7b381e78a63d8e05553d309d8001..ab0f05d6e50b3af1875fb755d841c2c33529d558 100644 (file)
@@ -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)
     }