]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/process/process-update.ts
Add last login date to users
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / process / process-update.ts
index 9f80a0ce9cb95219637d435b6caf4666b10d3bee..9579512b7e6062ab00a2078a75d501377489106c 100644 (file)
@@ -15,7 +15,8 @@ import { forwardVideoRelatedActivity } from '../send/utils'
 import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object'
 import { createOrUpdateVideoPlaylist } from '../playlist'
 import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorSignature } from '../../../typings/models'
+import { MActorSignature, MAccountIdActor } from '../../../typings/models'
+import { isRedundancyAccepted } from '@server/lib/redundancy'
 
 async function processUpdateActivity (options: APProcessorOptions<ActivityUpdate>) {
   const { activity, byActor } = options
@@ -64,10 +65,13 @@ async function processUpdateVideo (actor: MActorSignature, activity: ActivityUpd
   const { video } = await getOrCreateVideoAndAccountAndChannel({ videoObject: videoObject.id, allowRefresh: false, fetchType: 'all' })
   const channelActor = await getOrCreateVideoChannelFromVideoObject(videoObject)
 
+  const account = actor.Account as MAccountIdActor
+  account.Actor = actor
+
   const updateOptions = {
     video,
     videoObject,
-    account: channelActor.VideoChannel.Account,
+    account,
     channel: channelActor.VideoChannel,
     overrideTo: activity.to
   }
@@ -75,6 +79,8 @@ async function processUpdateVideo (actor: MActorSignature, activity: ActivityUpd
 }
 
 async function processUpdateCacheFile (byActor: MActorSignature, activity: ActivityUpdate) {
+  if (await isRedundancyAccepted(activity, byActor) !== true) return
+
   const cacheFileObject = activity.object as CacheFileObject
 
   if (!isCacheFileObjectValid(cacheFileObject)) {