From a7d647c4403f8774106f485e8d9323158454e111 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 15 Dec 2017 17:34:38 +0100 Subject: Add dirty migration :/ --- server/lib/activitypub/share.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'server/lib/activitypub') diff --git a/server/lib/activitypub/share.ts b/server/lib/activitypub/share.ts index f79c4e532..fb01368ec 100644 --- a/server/lib/activitypub/share.ts +++ b/server/lib/activitypub/share.ts @@ -4,17 +4,27 @@ import { VideoModel } from '../../models/video/video' import { VideoShareModel } from '../../models/video/video-share' import { sendVideoAnnounceToFollowers } from './send' -async function shareVideoByServer (video: VideoModel, t: Transaction) { +async function shareVideoByServerAndChannel (video: VideoModel, t: Transaction) { const serverActor = await getServerActor() - await VideoShareModel.create({ + const serverShare = VideoShareModel.create({ actorId: serverActor.id, videoId: video.id }, { transaction: t }) + const videoChannelShare = VideoShareModel.create({ + actorId: video.VideoChannel.actorId, + videoId: video.id + }, { transaction: t }) + + await Promise.all([ + serverShare, + videoChannelShare + ]) + return sendVideoAnnounceToFollowers(serverActor, video, t) } export { - shareVideoByServer + shareVideoByServerAndChannel } -- cgit v1.2.3