diff options
author | Chocobozzz <me@florianbigard.com> | 2018-07-24 15:11:28 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-07-24 15:11:28 +0200 |
commit | 77de223a5f5aca1dc32e23ca22a8ac7d8b009c4f (patch) | |
tree | b553057ed3e5e60491bc25dff07fbee8812d9033 | |
parent | 98d3324db3b1c345fc30e5dbcef3b1e11169867e (diff) | |
download | PeerTube-77de223a5f5aca1dc32e23ca22a8ac7d8b009c4f.tar.gz PeerTube-77de223a5f5aca1dc32e23ca22a8ac7d8b009c4f.tar.zst PeerTube-77de223a5f5aca1dc32e23ca22a8ac7d8b009c4f.zip |
Fix publishedAt after a scheduled update
-rw-r--r-- | server/lib/schedulers/update-videos-scheduler.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/server/lib/schedulers/update-videos-scheduler.ts b/server/lib/schedulers/update-videos-scheduler.ts index 760475af9..fd2edfd17 100644 --- a/server/lib/schedulers/update-videos-scheduler.ts +++ b/server/lib/schedulers/update-videos-scheduler.ts | |||
@@ -43,11 +43,12 @@ export class UpdateVideosScheduler extends AbstractScheduler { | |||
43 | 43 | ||
44 | if (schedule.privacy) { | 44 | if (schedule.privacy) { |
45 | const oldPrivacy = video.privacy | 45 | const oldPrivacy = video.privacy |
46 | const isNewVideo = oldPrivacy === VideoPrivacy.PRIVATE | ||
46 | 47 | ||
47 | video.privacy = schedule.privacy | 48 | video.privacy = schedule.privacy |
48 | await video.save({ transaction: t }) | 49 | if (isNewVideo === true) video.publishedAt = new Date() |
49 | 50 | ||
50 | const isNewVideo = oldPrivacy === VideoPrivacy.PRIVATE | 51 | await video.save({ transaction: t }) |
51 | await federateVideoIfNeeded(video, isNewVideo, t) | 52 | await federateVideoIfNeeded(video, isNewVideo, t) |
52 | } | 53 | } |
53 | 54 | ||