From c883db6d038a8510205f5f13ef46fb5a1c9e8288 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 4 Dec 2019 11:48:12 +0100 Subject: Move deleted comment on new follow tests --- server/lib/activitypub/send/send-delete.ts | 5 +++-- server/lib/activitypub/video-comments.ts | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'server/lib') 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: : videoComment.Video.VideoChannel.Account.Actor const threadParentComments = await VideoCommentModel.listThreadParentComments(videoComment, t) + const threadParentCommentsFiltered = threadParentComments.filter(c => !c.isDeleted()) const actorsInvolvedInComment = await getActorsInvolvedInVideo(videoComment.Video, t) actorsInvolvedInComment.push(byActor) // Add the actor that commented the video - const audience = getVideoCommentAudience(videoComment, threadParentComments, actorsInvolvedInComment, isVideoOrigin) + const audience = getVideoCommentAudience(videoComment, threadParentCommentsFiltered, actorsInvolvedInComment, isVideoOrigin) const activity = buildDeleteActivity(url, videoComment.url, byActor, audience) // This was a reply, send it to the parent actors const actorsException = [ byActor ] - await broadcastToActors(activity, byActor, threadParentComments.map(c => c.Account.Actor), t, actorsException) + await broadcastToActors(activity, byActor, threadParentCommentsFiltered.map(c => c.Account.Actor), t, actorsException) // Broadcast to our followers 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) { throw new Error(`Comment url ${url} host is different from the AP object id ${body.id}`) } - const actor = actorUrl ? await getOrCreateActorAndServerAndModel(actorUrl, 'all') : null + const actor = actorUrl + ? await getOrCreateActorAndServerAndModel(actorUrl, 'all') + : null + const comment = new VideoCommentModel({ url: body.id, text: body.content ? body.content : '', -- cgit v1.2.3