From 511765c9f86fb07d5d856decd9dbf0ec2092f4fe Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 7 Aug 2019 15:35:29 +0200 Subject: Remove comment federation by video owner --- server/lib/activitypub/process/process-delete.ts | 6 +++--- server/lib/activitypub/send/send-delete.ts | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'server/lib') diff --git a/server/lib/activitypub/process/process-delete.ts b/server/lib/activitypub/process/process-delete.ts index 845a7b249..9fcfd9e3a 100644 --- a/server/lib/activitypub/process/process-delete.ts +++ b/server/lib/activitypub/process/process-delete.ts @@ -34,7 +34,7 @@ async function processDeleteActivity (options: APProcessorOptions { - if (videoComment.Account.id !== byActor.Account.id) { - throw new Error('Account ' + byActor.url + ' does not own video comment ' + videoComment.url) + if (byActor.Account.id !== videoComment.Account.id && byActor.Account.id !== videoComment.Video.VideoChannel.accountId) { + throw new Error(`Account ${byActor.url} does not own video comment ${videoComment.url} or video ${videoComment.Video.url}`) } await videoComment.destroy({ transaction: t }) diff --git a/server/lib/activitypub/send/send-delete.ts b/server/lib/activitypub/send/send-delete.ts index 7a1d6f0ba..6c7fb8449 100644 --- a/server/lib/activitypub/send/send-delete.ts +++ b/server/lib/activitypub/send/send-delete.ts @@ -48,7 +48,10 @@ async function sendDeleteVideoComment (videoComment: VideoCommentModel, t: Trans const isVideoOrigin = videoComment.Video.isOwned() const url = getDeleteActivityPubUrl(videoComment.url) - const byActor = videoComment.Account.Actor + const byActor = videoComment.isOwned() + ? videoComment.Account.Actor + : videoComment.Video.VideoChannel.Account.Actor + const threadParentComments = await VideoCommentModel.listThreadParentComments(videoComment, t) const actorsInvolvedInComment = await getActorsInvolvedInVideo(videoComment.Video, t) -- cgit v1.2.3