]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/video-comment.ts
Remove comment federation by video owner
[github/Chocobozzz/PeerTube.git] / server / lib / video-comment.ts
index 70ba7c3039cd947c3636d65d64418e80f810d111..449aa74cb10a1f503bf48e58fd6229078c380f1f 100644 (file)
@@ -27,10 +27,10 @@ async function createVideoComment (obj: {
     inReplyToCommentId,
     videoId: obj.video.id,
     accountId: obj.account.id,
-    url: 'fake url'
+    url: new Date().toISOString()
   }, { transaction: t, validate: false })
 
-  comment.set('url', getVideoCommentActivityPubUrl(obj.video, comment))
+  comment.url = getVideoCommentActivityPubUrl(obj.video, comment)
 
   const savedComment = await comment.save({ transaction: t })
   savedComment.InReplyToVideoComment = obj.inReplyToComment
@@ -64,10 +64,8 @@ function buildFormattedCommentTree (resultList: ResultList<VideoCommentModel>):
     }
 
     const parentCommentThread = idx[childComment.inReplyToCommentId]
-    if (!parentCommentThread) {
-      const msg = `Cannot format video thread tree, parent ${childComment.inReplyToCommentId} not found for child ${childComment.id}`
-      throw new Error(msg)
-    }
+    // Maybe the parent comment was blocked by the admin/user
+    if (!parentCommentThread) continue
 
     parentCommentThread.children.push(childCommentThread)
     idx[childComment.id] = childCommentThread