mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Remove comment federation by video owner
This commit is contained in:
@@ -34,7 +34,7 @@ async function processDeleteActivity (options: APProcessorOptions<ActivityDelete
|
||||
}
|
||||
|
||||
{
|
||||
const videoCommentInstance = await VideoCommentModel.loadByUrlAndPopulateAccount(objectUrl)
|
||||
const videoCommentInstance = await VideoCommentModel.loadByUrlAndPopulateAccountAndVideo(objectUrl)
|
||||
if (videoCommentInstance) {
|
||||
return retryTransactionWrapper(processDeleteVideoComment, byActor, videoCommentInstance, activity)
|
||||
}
|
||||
@@ -121,8 +121,8 @@ function processDeleteVideoComment (byActor: ActorModel, videoComment: VideoComm
|
||||
logger.debug('Removing remote video comment "%s".', videoComment.url)
|
||||
|
||||
return sequelizeTypescript.transaction(async t => {
|
||||
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 })
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user