1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 10:49:28 +02:00

Put activity pub sends inside transactions

This commit is contained in:
Chocobozzz 2017-11-30 11:31:15 +01:00
parent 5cd8054542
commit 25ed141c7c
No known key found for this signature in database
GPG key ID: 583A612D890159BE
21 changed files with 144 additions and 113 deletions

View 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,