]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/send/send-update.ts
Manual approves followers only for the instance
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / send / send-update.ts
index 3a5cc185367e854ebe05bee2f27028eba121397b..9c76671b5d8b931bdbbeef4fe14f7cbcd06bf9a2 100644 (file)
@@ -12,10 +12,10 @@ import { VideoCaptionModel } from '../../../models/video/video-caption'
 import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model'
 import { getServerActor } from '../../../helpers/utils'
 import {
-  MAccountActor,
+  MAccountDefault,
   MActor,
   MActorLight,
-  MChannelActor,
+  MChannelDefault,
   MVideoAP,
   MVideoAPWithoutCaption,
   MVideoPlaylistFull,
@@ -25,7 +25,7 @@ import {
 async function sendUpdateVideo (videoArg: MVideoAPWithoutCaption, t: Transaction, overrodeByActor?: MActor) {
   const video = videoArg as MVideoAP
 
-  if (video.privacy === VideoPrivacy.PRIVATE) return undefined
+  if (!video.hasPrivacyForFederation()) return undefined
 
   logger.info('Creating job to update video %s.', video.url)
 
@@ -35,7 +35,7 @@ async function sendUpdateVideo (videoArg: MVideoAPWithoutCaption, t: Transaction
 
   // Needed to build the AP object
   if (!video.VideoCaptions) {
-    video.VideoCaptions = await video.$get('VideoCaptions', { transaction: t }) as VideoCaptionModel[]
+    video.VideoCaptions = await video.$get('VideoCaptions', { transaction: t })
   }
 
   const videoObject = video.toActivityPubObject()
@@ -49,13 +49,13 @@ async function sendUpdateVideo (videoArg: MVideoAPWithoutCaption, t: Transaction
   return broadcastToFollowers(updateActivity, byActor, actorsInvolved, t)
 }
 
-async function sendUpdateActor (accountOrChannel: MAccountActor | MChannelActor, t: Transaction) {
+async function sendUpdateActor (accountOrChannel: MChannelDefault | MAccountDefault, t: Transaction) {
   const byActor = accountOrChannel.Actor
 
   logger.info('Creating job to update actor %s.', byActor.url)
 
   const url = getUpdateActivityPubUrl(byActor.url, byActor.updatedAt.toISOString())
-  const accountOrChannelObject = accountOrChannel.toActivityPubObject()
+  const accountOrChannelObject = (accountOrChannel as any).toActivityPubObject() // FIXME: typescript bug?
   const audience = getAudience(byActor)
   const updateActivity = buildUpdateActivity(url, byActor, accountOrChannelObject, audience)