From 5cf84858d49f4231cc4efec5e3132f17f65f6cf6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 4 Sep 2018 10:22:10 +0200 Subject: Add federation to ownership change --- server/lib/activitypub/send/send-update.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'server/lib/activitypub/send/send-update.ts') diff --git a/server/lib/activitypub/send/send-update.ts b/server/lib/activitypub/send/send-update.ts index 17d4f185c..6f1d80898 100644 --- a/server/lib/activitypub/send/send-update.ts +++ b/server/lib/activitypub/send/send-update.ts @@ -10,13 +10,19 @@ import { getUpdateActivityPubUrl } from '../url' import { broadcastToFollowers } from './utils' import { audiencify, getAudience } from '../audience' import { logger } from '../../../helpers/logger' +import { videoFeedsValidator } from '../../../middlewares/validators' +import { VideoCaptionModel } from '../../../models/video/video-caption' -async function sendUpdateVideo (video: VideoModel, t: Transaction) { +async function sendUpdateVideo (video: VideoModel, t: Transaction, overrodeByActor?: ActorModel) { logger.info('Creating job to update video %s.', video.url) - const byActor = video.VideoChannel.Account.Actor + const byActor = overrodeByActor ? overrodeByActor : video.VideoChannel.Account.Actor const url = getUpdateActivityPubUrl(video.url, video.updatedAt.toISOString()) + + // Needed to build the AP object + if (!video.VideoCaptions) video.VideoCaptions = await video.$get('VideoCaptions') as VideoCaptionModel[] + const videoObject = video.toActivityPubObject() const audience = getAudience(byActor, video.privacy === VideoPrivacy.PUBLIC) -- cgit v1.2.3