-import { ActivityCreate } from '../../../../shared/models/activitypub/activity'
-import { AccountInstance, VideoChannelInstance, VideoInstance } from '../../../models'
-import { VideoAbuseInstance } from '../../../models/video/video-abuse-interface'
-import { broadcastToFollowers, getAudience, unicastTo } from './misc'
-import { getVideoAbuseActivityPubUrl, getVideoViewActivityPubUrl } from '../url'
-import { getServerAccount } from '../../../helpers/utils'
-import { database as db } from '../../../initializers'
+import { ActivityAudience, ActivityCreate } from '../../../../shared/models/activitypub'
+import { VideoPrivacy } from '../../../../shared/models/videos'
+import { getServerActor } from '../../../helpers'
+import { ActorModel } from '../../../models/activitypub/actor'
+import { VideoModel } from '../../../models/video/video'
+import { VideoAbuseModel } from '../../../models/video/video-abuse'
+import { getVideoAbuseActivityPubUrl, getVideoDislikeActivityPubUrl, getVideoViewActivityPubUrl } from '../url'
+import {
+ audiencify,
+ broadcastToFollowers,
+ getActorsInvolvedInVideo,
+ getAudience,
+ getObjectFollowersAudience,
+ getOriginVideoAudience,
+ unicastTo
+} from './misc'
+
+async function sendCreateVideo (video: VideoModel, t: Transaction) {
+ if (video.privacy === VideoPrivacy.PRIVATE) return undefined
+
+ const byActor = video.VideoChannel.Account.Actor
+ const videoObject = video.toActivityPubObject()
+
+ const audience = await getAudience(byActor, t, video.privacy === VideoPrivacy.PUBLIC)
+ const data = await createActivityData(video.url, byActor, videoObject, t, audience)
+
+ return broadcastToFollowers(data, byActor, [ byActor ], t)
+}