]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/process/process-flag.ts
Fix process abuse transactions
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / process / process-flag.ts
index 40d07558c64df23474be869997fab7a10a182c4a..7ed409d0e029678d44e04dd9c95be0682dfab989 100644 (file)
@@ -49,13 +49,12 @@ async function processCreateAbuse (activity: ActivityCreate | ActivityFlag, byAc
       logger.debug('Reporting remote abuse for object %s.', uri)
 
       await sequelizeTypescript.transaction(async t => {
-
-        const video = await VideoModel.loadByUrlAndPopulateAccount(uri)
+        const video = await VideoModel.loadByUrlAndPopulateAccount(uri, t)
         let videoComment: MCommentOwnerVideo
         let flaggedAccount: MAccountDefault
 
-        if (!video) videoComment = await VideoCommentModel.loadByUrlAndPopulateAccountAndVideo(uri)
-        if (!videoComment) flaggedAccount = await AccountModel.loadByUrl(uri)
+        if (!video) videoComment = await VideoCommentModel.loadByUrlAndPopulateAccountAndVideo(uri, t)
+        if (!videoComment) flaggedAccount = await AccountModel.loadByUrl(uri, t)
 
         if (!video && !videoComment && !flaggedAccount) {
           logger.warn('Cannot flag unknown entity %s.', object)