-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'
-
-async function sendCreateVideoChannel (videoChannel: VideoChannelInstance, t: Transaction) {
- const byAccount = videoChannel.Account
-
- const videoChannelObject = videoChannel.toActivityPubObject()
- const data = await createActivityData(videoChannel.url, byAccount, videoChannelObject)
+import { ActivityAudience, ActivityCreate } from '../../../../shared/models/activitypub'
+import { VideoPrivacy } from '../../../../shared/models/videos'
+import { VideoCommentModel } from '../../../models/video/video-comment'
+import { broadcastToActors, broadcastToFollowers, sendVideoRelatedActivity, unicastTo } from './utils'
+import { audiencify, getActorsInvolvedInVideo, getAudience, getAudienceFromFollowersOf, getVideoCommentAudience } from '../audience'
+import { logger, loggerTagsFactory } from '../../../helpers/logger'
+import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model'
+import {
+ MActorLight,
+ MCommentOwnerVideo,
+ MVideoAccountLight,
+ MVideoAP,
+ MVideoPlaylistFull,
+ MVideoRedundancyFileVideo,
+ MVideoRedundancyStreamingPlaylistVideo
+} from '../../../types/models'
+import { getServerActor } from '@server/models/application/application'
+import { ContextType } from '@shared/models/activitypub/context'
+
+const lTags = loggerTagsFactory('ap', 'create')
+
+async function sendCreateVideo (video: MVideoAP, t: Transaction) {
+ if (!video.hasPrivacyForFederation()) return undefined
+
+ logger.info('Creating job to send video creation of %s.', video.url, lTags(video.uuid))
+
+ const byActor = video.VideoChannel.Account.Actor
+ const videoObject = video.toActivityPubObject()
+
+ const audience = getAudience(byActor, video.privacy === VideoPrivacy.PUBLIC)
+ const createActivity = buildCreateActivity(video.url, byActor, videoObject, audience)
+
+ return broadcastToFollowers(createActivity, byActor, [ byActor ], t)
+}