aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-12-04 11:48:12 +0100
committerChocobozzz <me@florianbigard.com>2019-12-04 11:48:12 +0100
commitc883db6d038a8510205f5f13ef46fb5a1c9e8288 (patch)
treed8becd3b5cf3bddf14559f062d7ca4f96d1b25c3 /server/lib
parentb5206dfc455c119b0dcb897bd7144be6ea4d999d (diff)
downloadPeerTube-c883db6d038a8510205f5f13ef46fb5a1c9e8288.tar.gz
PeerTube-c883db6d038a8510205f5f13ef46fb5a1c9e8288.tar.zst
PeerTube-c883db6d038a8510205f5f13ef46fb5a1c9e8288.zip
Move deleted comment on new follow tests
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/activitypub/send/send-delete.ts5
-rw-r--r--server/lib/activitypub/video-comments.ts5
2 files changed, 7 insertions, 3 deletions
diff --git a/server/lib/activitypub/send/send-delete.ts b/server/lib/activitypub/send/send-delete.ts
index a91756ff4..3225ebf32 100644
--- a/server/lib/activitypub/send/send-delete.ts
+++ b/server/lib/activitypub/send/send-delete.ts
@@ -53,16 +53,17 @@ async function sendDeleteVideoComment (videoComment: MCommentOwnerVideoReply, t:
53 : videoComment.Video.VideoChannel.Account.Actor 53 : videoComment.Video.VideoChannel.Account.Actor
54 54
55 const threadParentComments = await VideoCommentModel.listThreadParentComments(videoComment, t) 55 const threadParentComments = await VideoCommentModel.listThreadParentComments(videoComment, t)
56 const threadParentCommentsFiltered = threadParentComments.filter(c => !c.isDeleted())
56 57
57 const actorsInvolvedInComment = await getActorsInvolvedInVideo(videoComment.Video, t) 58 const actorsInvolvedInComment = await getActorsInvolvedInVideo(videoComment.Video, t)
58 actorsInvolvedInComment.push(byActor) // Add the actor that commented the video 59 actorsInvolvedInComment.push(byActor) // Add the actor that commented the video
59 60
60 const audience = getVideoCommentAudience(videoComment, threadParentComments, actorsInvolvedInComment, isVideoOrigin) 61 const audience = getVideoCommentAudience(videoComment, threadParentCommentsFiltered, actorsInvolvedInComment, isVideoOrigin)
61 const activity = buildDeleteActivity(url, videoComment.url, byActor, audience) 62 const activity = buildDeleteActivity(url, videoComment.url, byActor, audience)
62 63
63 // This was a reply, send it to the parent actors 64 // This was a reply, send it to the parent actors
64 const actorsException = [ byActor ] 65 const actorsException = [ byActor ]
65 await broadcastToActors(activity, byActor, threadParentComments.map(c => c.Account.Actor), t, actorsException) 66 await broadcastToActors(activity, byActor, threadParentCommentsFiltered.map(c => c.Account.Actor), t, actorsException)
66 67
67 // Broadcast to our followers 68 // Broadcast to our followers
68 await broadcastToFollowers(activity, byActor, [ byActor ], t) 69 await broadcastToFollowers(activity, byActor, [ byActor ], t)
diff --git a/server/lib/activitypub/video-comments.ts b/server/lib/activitypub/video-comments.ts
index 1a15842cf..d5c078a29 100644
--- a/server/lib/activitypub/video-comments.ts
+++ b/server/lib/activitypub/video-comments.ts
@@ -141,7 +141,10 @@ async function resolveParentComment (params: ResolveThreadParams) {
141 throw new Error(`Comment url ${url} host is different from the AP object id ${body.id}`) 141 throw new Error(`Comment url ${url} host is different from the AP object id ${body.id}`)
142 } 142 }
143 143
144 const actor = actorUrl ? await getOrCreateActorAndServerAndModel(actorUrl, 'all') : null 144 const actor = actorUrl
145 ? await getOrCreateActorAndServerAndModel(actorUrl, 'all')
146 : null
147
145 const comment = new VideoCommentModel({ 148 const comment = new VideoCommentModel({
146 url: body.id, 149 url: body.id,
147 text: body.content ? body.content : '', 150 text: body.content ? body.content : '',