1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

Move deleted comment on new follow tests

This commit is contained in:
Chocobozzz 2019-12-04 11:48:12 +01:00
parent b5206dfc45
commit c883db6d03
No known key found for this signature in database
GPG key ID: 583A612D890159BE
6 changed files with 124 additions and 92 deletions

View file

@ -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)

View file

@ -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 : '',