]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/video-comment.ts
Add playlist search option and search input for add-to-video-playlist dropdown
[github/Chocobozzz/PeerTube.git] / server / models / video / video-comment.ts
index b44d65138f1bdfd476a3a9680692ba2d587055b3..869a42afef0f14197fa8bf4643c7e87058651017 100644 (file)
@@ -507,27 +507,30 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
   }
 
   toActivityPubObject (this: MCommentAP, threadParentComments: MCommentOwner[]): VideoCommentObject | ActivityTombstoneObject {
+    let inReplyTo: string
+    // New thread, so in AS we reply to the video
+    if (this.inReplyToCommentId === null) {
+      inReplyTo = this.Video.url
+    } else {
+      inReplyTo = this.InReplyToVideoComment.url
+    }
+
     if (this.isDeleted()) {
       return {
         id: this.url,
         type: 'Tombstone',
         formerType: 'Note',
+        inReplyTo,
         published: this.createdAt.toISOString(),
         updated: this.updatedAt.toISOString(),
         deleted: this.deletedAt.toISOString()
       }
     }
 
-    let inReplyTo: string
-    // New thread, so in AS we reply to the video
-    if (this.inReplyToCommentId === null) {
-      inReplyTo = this.Video.url
-    } else {
-      inReplyTo = this.InReplyToVideoComment.url
-    }
-
     const tag: ActivityTagObject[] = []
     for (const parentComment of threadParentComments) {
+      if (!parentComment.Account) continue
+
       const actor = parentComment.Account.Actor
 
       tag.push({