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-update.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-update.ts')
-rw-r--r-- | server/lib/activitypub/send/send-update.ts | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/server/lib/activitypub/send/send-update.ts b/server/lib/activitypub/send/send-update.ts index 32cada06e..59524e523 100644 --- a/server/lib/activitypub/send/send-update.ts +++ b/server/lib/activitypub/send/send-update.ts | |||
@@ -10,9 +10,9 @@ async function sendUpdateVideoChannel (videoChannel: VideoChannelInstance, t: Tr | |||
10 | 10 | ||
11 | const url = getUpdateActivityPubUrl(videoChannel.url, videoChannel.updatedAt.toISOString()) | 11 | const url = getUpdateActivityPubUrl(videoChannel.url, videoChannel.updatedAt.toISOString()) |
12 | const videoChannelObject = videoChannel.toActivityPubObject() | 12 | const videoChannelObject = videoChannel.toActivityPubObject() |
13 | const data = await updateActivityData(url, byAccount, videoChannelObject) | 13 | const data = await updateActivityData(url, byAccount, videoChannelObject, t) |
14 | 14 | ||
15 | const accountsInvolved = await db.VideoChannelShare.loadAccountsByShare(videoChannel.id) | 15 | const accountsInvolved = await db.VideoChannelShare.loadAccountsByShare(videoChannel.id, t) |
16 | accountsInvolved.push(byAccount) | 16 | accountsInvolved.push(byAccount) |
17 | 17 | ||
18 | return broadcastToFollowers(data, byAccount, accountsInvolved, t) | 18 | return broadcastToFollowers(data, byAccount, accountsInvolved, t) |
@@ -23,9 +23,9 @@ async function sendUpdateVideo (video: VideoInstance, t: Transaction) { | |||
23 | 23 | ||
24 | const url = getUpdateActivityPubUrl(video.url, video.updatedAt.toISOString()) | 24 | const url = getUpdateActivityPubUrl(video.url, video.updatedAt.toISOString()) |
25 | const videoObject = video.toActivityPubObject() | 25 | const videoObject = video.toActivityPubObject() |
26 | const data = await updateActivityData(url, byAccount, videoObject) | 26 | const data = await updateActivityData(url, byAccount, videoObject, t) |
27 | 27 | ||
28 | const accountsInvolved = await db.VideoShare.loadAccountsByShare(video.id) | 28 | const accountsInvolved = await db.VideoShare.loadAccountsByShare(video.id, t) |
29 | accountsInvolved.push(byAccount) | 29 | accountsInvolved.push(byAccount) |
30 | 30 | ||
31 | return broadcastToFollowers(data, byAccount, accountsInvolved, t) | 31 | return broadcastToFollowers(data, byAccount, accountsInvolved, t) |
@@ -40,8 +40,8 @@ export { | |||
40 | 40 | ||
41 | // --------------------------------------------------------------------------- | 41 | // --------------------------------------------------------------------------- |
42 | 42 | ||
43 | async function updateActivityData (url: string, byAccount: AccountInstance, object: any) { | 43 | async function updateActivityData (url: string, byAccount: AccountInstance, object: any, t: Transaction) { |
44 | const { to, cc } = await getAudience(byAccount) | 44 | const { to, cc } = await getAudience(byAccount, t) |
45 | const activity: ActivityUpdate = { | 45 | const activity: ActivityUpdate = { |
46 | type: 'Update', | 46 | type: 'Update', |
47 | id: url, | 47 | id: url, |