]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/send/send-delete.ts
Put activity pub sends inside transactions
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / send / send-delete.ts
index 5be0e2d247568a5c9f3a736045221483aae8bbb8..c49cda04f905f6da7e39614e7a145bfcfab5b3d4 100644 (file)
@@ -7,9 +7,9 @@ import { broadcastToFollowers } from './misc'
 async function sendDeleteVideoChannel (videoChannel: VideoChannelInstance, t: Transaction) {
   const byAccount = videoChannel.Account
 
-  const data = await deleteActivityData(videoChannel.url, byAccount)
+  const data = deleteActivityData(videoChannel.url, byAccount)
 
-  const accountsInvolved = await db.VideoChannelShare.loadAccountsByShare(videoChannel.id)
+  const accountsInvolved = await db.VideoChannelShare.loadAccountsByShare(videoChannel.id, t)
   accountsInvolved.push(byAccount)
 
   return broadcastToFollowers(data, byAccount, accountsInvolved, t)
@@ -18,9 +18,9 @@ async function sendDeleteVideoChannel (videoChannel: VideoChannelInstance, t: Tr
 async function sendDeleteVideo (video: VideoInstance, t: Transaction) {
   const byAccount = video.VideoChannel.Account
 
-  const data = await deleteActivityData(video.url, byAccount)
+  const data = deleteActivityData(video.url, byAccount)
 
-  const accountsInvolved = await db.VideoShare.loadAccountsByShare(video.id)
+  const accountsInvolved = await db.VideoShare.loadAccountsByShare(video.id, t)
   accountsInvolved.push(byAccount)
 
   return broadcastToFollowers(data, byAccount, accountsInvolved, t)
@@ -42,7 +42,7 @@ export {
 
 // ---------------------------------------------------------------------------
 
-async function deleteActivityData (url: string, byAccount: AccountInstance) {
+function deleteActivityData (url: string, byAccount: AccountInstance) {
   const activity: ActivityDelete = {
     type: 'Delete',
     id: url,