1 import { Transaction } from 'sequelize'
2 import { ActivityAdd } from '../../../../shared/models/activitypub'
3 import { VideoPrivacy } from '../../../../shared/models/videos'
4 import { AccountModel } from '../../../models/account/account'
5 import { VideoModel } from '../../../models/video/video'
6 import { broadcastToFollowers, getAudience } from './misc'
8 async function sendAddVideo (video: VideoModel, t: Transaction) {
9 const byAccount = video.VideoChannel.Account
11 const videoObject = video.toActivityPubObject()
12 const data = await addActivityData(video.url, byAccount, video, video.VideoChannel.url, videoObject, t)
14 return broadcastToFollowers(data, byAccount, [ byAccount ], t)
17 async function addActivityData (
19 byAccount: AccountModel,
24 ): Promise<ActivityAdd> {
25 const videoPublic = video.privacy === VideoPrivacy.PUBLIC
27 const { to, cc } = await getAudience(byAccount, t, videoPublic)
40 // ---------------------------------------------------------------------------