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:
parent
5cd8054542
commit
25ed141c7c
21 changed files with 144 additions and 113 deletions
|
@ -8,15 +8,22 @@ async function sendAddVideo (video: VideoInstance, t: Transaction) {
|
|||
const byAccount = video.VideoChannel.Account
|
||||
|
||||
const videoObject = video.toActivityPubObject()
|
||||
const data = await addActivityData(video.url, byAccount, video, video.VideoChannel.url, videoObject)
|
||||
const data = await addActivityData(video.url, byAccount, video, video.VideoChannel.url, videoObject, t)
|
||||
|
||||
return broadcastToFollowers(data, byAccount, [ byAccount ], t)
|
||||
}
|
||||
|
||||
async function addActivityData (url: string, byAccount: AccountInstance, video: VideoInstance, target: string, object: any) {
|
||||
async function addActivityData (
|
||||
url: string,
|
||||
byAccount: AccountInstance,
|
||||
video: VideoInstance,
|
||||
target: string,
|
||||
object: any,
|
||||
t: Transaction
|
||||
) {
|
||||
const videoPublic = video.privacy === VideoPrivacy.PUBLIC
|
||||
|
||||
const { to, cc } = await getAudience(byAccount, videoPublic)
|
||||
const { to, cc } = await getAudience(byAccount, t, videoPublic)
|
||||
const activity: ActivityAdd = {
|
||||
type: 'Add',
|
||||
id: url,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue