X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Factivitypub%2Fprocess%2Fprocess-delete.ts;h=ac0e7e235aaeb4e116188c06c662448bbd1fe008;hb=7a4fd56ccd86518a6b14c407fc977c7904337448;hp=20214246c3492edf5eff291de390b58da8eb3fbd;hpb=1e4d2cb5aef11898585fae4053da4ebd0a69b480;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/activitypub/process/process-delete.ts b/server/lib/activitypub/process/process-delete.ts index 20214246c..ac0e7e235 100644 --- a/server/lib/activitypub/process/process-delete.ts +++ b/server/lib/activitypub/process/process-delete.ts @@ -16,8 +16,7 @@ import { MChannelActor, MCommentOwnerVideo } from '../../../types/models' -import { markCommentAsDeleted } from '../../video-comment' -import { forwardVideoRelatedActivity } from '../send/utils' +import { forwardVideoRelatedActivity } from '../send/shared/send-utils' async function processDeleteActivity (options: APProcessorOptions) { const { activity, byActor } = options @@ -130,7 +129,7 @@ async function processDeleteVideoChannel (videoChannelToRemove: MChannelActor) { function processDeleteVideoComment (byActor: MActorSignature, videoComment: MCommentOwnerVideo, activity: ActivityDelete) { // Already deleted - if (videoComment.isDeleted()) return + if (videoComment.isDeleted()) return Promise.resolve() logger.debug('Removing remote video comment "%s".', videoComment.url) @@ -139,11 +138,9 @@ function processDeleteVideoComment (byActor: MActorSignature, videoComment: MCom throw new Error(`Account ${byActor.url} does not own video comment ${videoComment.url} or video ${videoComment.Video.url}`) } - await sequelizeTypescript.transaction(async t => { - markCommentAsDeleted(videoComment) + videoComment.markAsDeleted() - await videoComment.save() - }) + await videoComment.save({ transaction: t }) if (videoComment.Video.isOwned()) { // Don't resend the activity to the sender