]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/process/process-delete.ts
Merge branch 'release/4.2.0' into develop
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / process / process-delete.ts
index 20214246c3492edf5eff291de390b58da8eb3fbd..ac0e7e235aaeb4e116188c06c662448bbd1fe008 100644 (file)
@@ -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<ActivityDelete>) {
   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