aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/schedulers/update-videos-scheduler.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/schedulers/update-videos-scheduler.ts')
-rw-r--r--server/lib/schedulers/update-videos-scheduler.ts10
1 files changed, 4 insertions, 6 deletions
diff --git a/server/lib/schedulers/update-videos-scheduler.ts b/server/lib/schedulers/update-videos-scheduler.ts
index 293bba91f..350a335d3 100644
--- a/server/lib/schedulers/update-videos-scheduler.ts
+++ b/server/lib/schedulers/update-videos-scheduler.ts
@@ -35,16 +35,14 @@ export class UpdateVideosScheduler extends AbstractScheduler {
35 logger.info('Executing scheduled video update on %s.', video.uuid) 35 logger.info('Executing scheduled video update on %s.', video.uuid)
36 36
37 if (schedule.privacy) { 37 if (schedule.privacy) {
38 const oldPrivacy = video.privacy 38 const wasConfidentialVideo = video.isConfidential()
39 const isNewVideo = oldPrivacy === VideoPrivacy.PRIVATE 39 const isNewVideo = video.isNewVideo(schedule.privacy)
40
41 video.privacy = schedule.privacy
42 if (isNewVideo === true) video.publishedAt = new Date()
43 40
41 video.setPrivacy(schedule.privacy)
44 await video.save({ transaction: t }) 42 await video.save({ transaction: t })
45 await federateVideoIfNeeded(video, isNewVideo, t) 43 await federateVideoIfNeeded(video, isNewVideo, t)
46 44
47 if (oldPrivacy === VideoPrivacy.UNLISTED || oldPrivacy === VideoPrivacy.PRIVATE) { 45 if (wasConfidentialVideo) {
48 const videoToPublish: MVideoFullLight = Object.assign(video, { ScheduleVideoUpdate: schedule, UserVideoHistories: [] }) 46 const videoToPublish: MVideoFullLight = Object.assign(video, { ScheduleVideoUpdate: schedule, UserVideoHistories: [] })
49 publishedVideos.push(videoToPublish) 47 publishedVideos.push(videoToPublish)
50 } 48 }