From c3badc81fe3d78601fb278a7f28eeed63060d300 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 4 Jan 2018 16:56:36 +0100 Subject: Fix delete activities --- server/lib/activitypub/send/send-delete.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'server/lib/activitypub/send') diff --git a/server/lib/activitypub/send/send-delete.ts b/server/lib/activitypub/send/send-delete.ts index 1ca031898..995a534a6 100644 --- a/server/lib/activitypub/send/send-delete.ts +++ b/server/lib/activitypub/send/send-delete.ts @@ -4,12 +4,14 @@ import { ActorModel } from '../../../models/activitypub/actor' import { VideoModel } from '../../../models/video/video' import { VideoCommentModel } from '../../../models/video/video-comment' import { VideoShareModel } from '../../../models/video/video-share' +import { getDeleteActivityPubUrl } from '../url' import { broadcastToFollowers } from './misc' async function sendDeleteVideo (video: VideoModel, t: Transaction) { + const url = getDeleteActivityPubUrl(video.url) const byActor = video.VideoChannel.Account.Actor - const data = deleteActivityData(video.url, byActor) + const data = deleteActivityData(url, video.url, byActor) const actorsInvolved = await VideoShareModel.loadActorsByShare(video.id, t) actorsInvolved.push(byActor) @@ -18,15 +20,17 @@ async function sendDeleteVideo (video: VideoModel, t: Transaction) { } async function sendDeleteActor (byActor: ActorModel, t: Transaction) { - const data = deleteActivityData(byActor.url, byActor) + const url = getDeleteActivityPubUrl(byActor.url) + const data = deleteActivityData(url, byActor.url, byActor) return broadcastToFollowers(data, byActor, [ byActor ], t) } async function sendDeleteVideoComment (videoComment: VideoCommentModel, t: Transaction) { - const byActor = videoComment.Account.Actor + const url = getDeleteActivityPubUrl(videoComment.url) - const data = deleteActivityData(videoComment.url, byActor) + const byActor = videoComment.Account.Actor + const data = deleteActivityData(url, videoComment.url, byActor) const actorsInvolved = await VideoShareModel.loadActorsByShare(videoComment.Video.id, t) actorsInvolved.push(videoComment.Video.VideoChannel.Account.Actor) @@ -45,10 +49,11 @@ export { // --------------------------------------------------------------------------- -function deleteActivityData (url: string, byActor: ActorModel): ActivityDelete { +function deleteActivityData (url: string, object: string, byActor: ActorModel): ActivityDelete { return { type: 'Delete', id: url, - actor: byActor.url + actor: byActor.url, + object } } -- cgit v1.2.3