]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/send/send-create.ts
Fix add comment in threads with deleted comments
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / send / send-create.ts
index 3585d704aeea8909e097731f1bd830bda0f70701..e2fa061e882f033dd4abc7306221d0af63a63825 100644 (file)
@@ -16,6 +16,7 @@ import {
   MVideoRedundancyFileVideo,
   MVideoRedundancyStreamingPlaylistVideo
 } from '../../../typings/models'
+import { ContextType } from '@server/helpers/activitypub'
 
 async function sendCreateVideo (video: MVideoAP, t: Transaction) {
   if (!video.hasPrivacyForFederation()) return undefined
@@ -42,7 +43,8 @@ async function sendCreateCacheFile (
     byActor,
     video,
     url: fileRedundancy.url,
-    object: fileRedundancy.toActivityPubObject()
+    object: fileRedundancy.toActivityPubObject(),
+    contextType: 'CacheFile'
   })
 }
 
@@ -78,7 +80,8 @@ async function sendCreateVideoComment (comment: MCommentOwnerVideo, t: Transacti
   // Add the actor that commented too
   actorsInvolvedInComment.push(byActor)
 
-  const parentsCommentActors = threadParentComments.map(c => c.Account.Actor)
+  const parentsCommentActors = threadParentComments.filter(c => !c.isDeleted())
+                                                   .map(c => c.Account.Actor)
 
   let audience: ActivityAudience
   if (isOrigin) {
@@ -135,6 +138,7 @@ async function sendVideoRelatedCreateActivity (options: {
   url: string
   object: any
   transaction?: Transaction
+  contextType?: ContextType
 }) {
   const activityBuilder = (audience: ActivityAudience) => {
     return buildCreateActivity(options.url, options.byActor, options.object, audience)