+ object: fileRedundancy.toActivityPubObject(),
+ contextType: 'CacheFile'
+ })
+}
+
+async function sendCreateWatchAction (stats: MLocalVideoViewerWithWatchSections, transaction: Transaction) {
+ logger.info('Creating job to send create watch action %s.', stats.url, lTags(stats.uuid))
+
+ const byActor = await getServerActor()
+
+ const activityBuilder = (audience: ActivityAudience) => {
+ return buildCreateActivity(stats.url, byActor, stats.toActivityPubObject(), audience)
+ }
+
+ return sendVideoActivityToOrigin(activityBuilder, { byActor, video: stats.Video, transaction, contextType: 'WatchAction' })
+}
+
+async function sendCreateVideoPlaylist (playlist: MVideoPlaylistFull, transaction: Transaction) {
+ if (playlist.privacy === VideoPlaylistPrivacy.PRIVATE) return undefined
+
+ logger.info('Creating job to send create video playlist of %s.', playlist.url, lTags(playlist.uuid))
+
+ const byActor = playlist.OwnerAccount.Actor
+ const audience = getAudience(byActor, playlist.privacy === VideoPlaylistPrivacy.PUBLIC)
+
+ const object = await playlist.toActivityPubObject(null, transaction)
+ const createActivity = buildCreateActivity(playlist.url, byActor, object, audience)
+
+ const serverActor = await getServerActor()
+ const toFollowersOf = [ byActor, serverActor ]
+
+ if (playlist.VideoChannel) toFollowersOf.push(playlist.VideoChannel.Actor)
+
+ return broadcastToFollowers({
+ data: createActivity,
+ byActor,
+ toFollowersOf,
+ transaction,
+ contextType: 'Playlist'