aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/schedulers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-12-12 15:47:47 +0100
committerChocobozzz <me@florianbigard.com>2019-12-12 16:51:59 +0100
commit22a73cb879a5cc775d4bec3d72fa9c9cf52e5175 (patch)
tree4c8d2d4f6fce8a520420ec83722fefc6d57b7a83 /server/lib/schedulers
parent91fa7960f42cff3481465bece3389007fbc278d3 (diff)
downloadPeerTube-22a73cb879a5cc775d4bec3d72fa9c9cf52e5175.tar.gz
PeerTube-22a73cb879a5cc775d4bec3d72fa9c9cf52e5175.tar.zst
PeerTube-22a73cb879a5cc775d4bec3d72fa9c9cf52e5175.zip
Add internal privacy mode
Diffstat (limited to 'server/lib/schedulers')
-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 }