aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/activitypub/share.ts16
-rw-r--r--server/lib/jobs/transcoding-job-scheduler/video-file-optimizer-handler.ts4
2 files changed, 15 insertions, 5 deletions
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'
4import { VideoShareModel } from '../../models/video/video-share' 4import { VideoShareModel } from '../../models/video/video-share'
5import { sendVideoAnnounceToFollowers } from './send' 5import { sendVideoAnnounceToFollowers } from './send'
6 6
7async function shareVideoByServer (video: VideoModel, t: Transaction) { 7async function shareVideoByServerAndChannel (video: VideoModel, t: Transaction) {
8 const serverActor = await getServerActor() 8 const serverActor = await getServerActor()
9 9
10 await VideoShareModel.create({ 10 const serverShare = VideoShareModel.create({
11 actorId: serverActor.id, 11 actorId: serverActor.id,
12 videoId: video.id 12 videoId: video.id
13 }, { transaction: t }) 13 }, { transaction: t })
14 14
15 const videoChannelShare = VideoShareModel.create({
16 actorId: video.VideoChannel.actorId,
17 videoId: video.id
18 }, { transaction: t })
19
20 await Promise.all([
21 serverShare,
22 videoChannelShare
23 ])
24
15 return sendVideoAnnounceToFollowers(serverActor, video, t) 25 return sendVideoAnnounceToFollowers(serverActor, video, t)
16} 26}
17 27
18export { 28export {
19 shareVideoByServer 29 shareVideoByServerAndChannel
20} 30}
diff --git a/server/lib/jobs/transcoding-job-scheduler/video-file-optimizer-handler.ts b/server/lib/jobs/transcoding-job-scheduler/video-file-optimizer-handler.ts
index 7df048006..cde4948de 100644
--- a/server/lib/jobs/transcoding-job-scheduler/video-file-optimizer-handler.ts
+++ b/server/lib/jobs/transcoding-job-scheduler/video-file-optimizer-handler.ts
@@ -2,7 +2,7 @@ import * as Bluebird from 'bluebird'
2import { computeResolutionsToTranscode, logger } from '../../../helpers' 2import { computeResolutionsToTranscode, logger } from '../../../helpers'
3import { sequelizeTypescript } from '../../../initializers' 3import { sequelizeTypescript } from '../../../initializers'
4import { VideoModel } from '../../../models/video/video' 4import { VideoModel } from '../../../models/video/video'
5import { shareVideoByServer } from '../../activitypub' 5import { shareVideoByServerAndChannel } from '../../activitypub'
6import { sendCreateVideo } from '../../activitypub/send' 6import { sendCreateVideo } from '../../activitypub/send'
7import { JobScheduler } from '../job-scheduler' 7import { JobScheduler } from '../job-scheduler'
8import { TranscodingJobPayload } from './transcoding-job-scheduler' 8import { TranscodingJobPayload } from './transcoding-job-scheduler'
@@ -38,7 +38,7 @@ async function onSuccess (jobId: number, video: VideoModel, jobScheduler: JobSch
38 // Now we'll add the video's meta data to our followers 38 // Now we'll add the video's meta data to our followers
39 await sendCreateVideo(video, undefined) 39 await sendCreateVideo(video, undefined)
40 // TODO: share by channel 40 // TODO: share by channel
41 await shareVideoByServer(video, undefined) 41 await shareVideoByServerAndChannel(video, undefined)
42 42
43 const originalFileHeight = await videoDatabase.getOriginalFileHeight() 43 const originalFileHeight = await videoDatabase.getOriginalFileHeight()
44 44