]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix publishedAt after a scheduled update
authorChocobozzz <me@florianbigard.com>
Tue, 24 Jul 2018 13:11:28 +0000 (15:11 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 24 Jul 2018 13:11:28 +0000 (15:11 +0200)
server/lib/schedulers/update-videos-scheduler.ts

index 760475af9bbc545d2e60d3bb5b710f87f83aef91..fd2edfd1702007665ce8cf03279db14194547c30 100644 (file)
@@ -43,11 +43,12 @@ export class UpdateVideosScheduler extends AbstractScheduler {
 
         if (schedule.privacy) {
           const oldPrivacy = video.privacy
+          const isNewVideo = oldPrivacy === VideoPrivacy.PRIVATE
 
           video.privacy = schedule.privacy
-          await video.save({ transaction: t })
+          if (isNewVideo === true) video.publishedAt = new Date()
 
-          const isNewVideo = oldPrivacy === VideoPrivacy.PRIVATE
+          await video.save({ transaction: t })
           await federateVideoIfNeeded(video, isNewVideo, t)
         }