X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Factivitypub%2Fsend%2Fsend-update.ts;h=59524e523738b636dc36d0eae3f46f5e570f5e94;hb=25ed141c7c7631ef21d8764c1163fbf8a6591391;hp=42738f973e18485f9e94f69222c9511d1f6ab3f4;hpb=54141398354e6e7b94aa3065a705a1251390111c;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/activitypub/send/send-update.ts b/server/lib/activitypub/send/send-update.ts index 42738f973..59524e523 100644 --- a/server/lib/activitypub/send/send-update.ts +++ b/server/lib/activitypub/send/send-update.ts @@ -1,8 +1,8 @@ import { Transaction } from 'sequelize' import { ActivityUpdate } from '../../../../shared/models/activitypub/activity' -import { getUpdateActivityPubUrl } from '../../../helpers/activitypub' import { database as db } from '../../../initializers' import { AccountInstance, VideoChannelInstance, VideoInstance } from '../../../models' +import { getUpdateActivityPubUrl } from '../url' import { broadcastToFollowers, getAudience } from './misc' async function sendUpdateVideoChannel (videoChannel: VideoChannelInstance, t: Transaction) { @@ -10,9 +10,9 @@ async function sendUpdateVideoChannel (videoChannel: VideoChannelInstance, t: Tr const url = getUpdateActivityPubUrl(videoChannel.url, videoChannel.updatedAt.toISOString()) const videoChannelObject = videoChannel.toActivityPubObject() - const data = await updateActivityData(url, byAccount, videoChannelObject) + const data = await updateActivityData(url, byAccount, videoChannelObject, t) - 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) @@ -23,9 +23,9 @@ async function sendUpdateVideo (video: VideoInstance, t: Transaction) { const url = getUpdateActivityPubUrl(video.url, video.updatedAt.toISOString()) const videoObject = video.toActivityPubObject() - const data = await updateActivityData(url, byAccount, videoObject) + const data = await updateActivityData(url, byAccount, videoObject, t) - 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) @@ -40,8 +40,8 @@ export { // --------------------------------------------------------------------------- -async function updateActivityData (url: string, byAccount: AccountInstance, object: any) { - const { to, cc } = await getAudience(byAccount) +async function updateActivityData (url: string, byAccount: AccountInstance, object: any, t: Transaction) { + const { to, cc } = await getAudience(byAccount, t) const activity: ActivityUpdate = { type: 'Update', id: url,