diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-30 11:31:15 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-30 11:31:15 +0100 |
commit | 25ed141c7c7631ef21d8764c1163fbf8a6591391 (patch) | |
tree | 8f556181a3369e7e4938d612d91be0af813e5067 /server/lib/activitypub/send/send-add.ts | |
parent | 5cd80545422bba855cc9a730a2e13cc9d982c34b (diff) | |
download | PeerTube-25ed141c7c7631ef21d8764c1163fbf8a6591391.tar.gz PeerTube-25ed141c7c7631ef21d8764c1163fbf8a6591391.tar.zst PeerTube-25ed141c7c7631ef21d8764c1163fbf8a6591391.zip |
Put activity pub sends inside transactions
Diffstat (limited to 'server/lib/activitypub/send/send-add.ts')
-rw-r--r-- | server/lib/activitypub/send/send-add.ts | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/server/lib/activitypub/send/send-add.ts b/server/lib/activitypub/send/send-add.ts index 3012b7533..d8ac2853e 100644 --- a/server/lib/activitypub/send/send-add.ts +++ b/server/lib/activitypub/send/send-add.ts | |||
@@ -8,15 +8,22 @@ async function sendAddVideo (video: VideoInstance, t: Transaction) { | |||
8 | const byAccount = video.VideoChannel.Account | 8 | const byAccount = video.VideoChannel.Account |
9 | 9 | ||
10 | const videoObject = video.toActivityPubObject() | 10 | const videoObject = video.toActivityPubObject() |
11 | const data = await addActivityData(video.url, byAccount, video, video.VideoChannel.url, videoObject) | 11 | const data = await addActivityData(video.url, byAccount, video, video.VideoChannel.url, videoObject, t) |
12 | 12 | ||
13 | return broadcastToFollowers(data, byAccount, [ byAccount ], t) | 13 | return broadcastToFollowers(data, byAccount, [ byAccount ], t) |
14 | } | 14 | } |
15 | 15 | ||
16 | async function addActivityData (url: string, byAccount: AccountInstance, video: VideoInstance, target: string, object: any) { | 16 | async function addActivityData ( |
17 | url: string, | ||
18 | byAccount: AccountInstance, | ||
19 | video: VideoInstance, | ||
20 | target: string, | ||
21 | object: any, | ||
22 | t: Transaction | ||
23 | ) { | ||
17 | const videoPublic = video.privacy === VideoPrivacy.PUBLIC | 24 | const videoPublic = video.privacy === VideoPrivacy.PUBLIC |
18 | 25 | ||
19 | const { to, cc } = await getAudience(byAccount, videoPublic) | 26 | const { to, cc } = await getAudience(byAccount, t, videoPublic) |
20 | const activity: ActivityAdd = { | 27 | const activity: ActivityAdd = { |
21 | type: 'Add', | 28 | type: 'Add', |
22 | id: url, | 29 | id: url, |