diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-28 16:58:15 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-28 16:58:15 +0200 |
commit | 1b952dd4266b0da4887701e0ce0860faded96768 (patch) | |
tree | fa49ac70a58ea5af94f39b68c7c135ca0d22c815 /server/lib/job-queue/handlers | |
parent | 6454845e2f7c44fdc6d4973c4b3daa9969ffab23 (diff) | |
download | PeerTube-1b952dd4266b0da4887701e0ce0860faded96768.tar.gz PeerTube-1b952dd4266b0da4887701e0ce0860faded96768.tar.zst PeerTube-1b952dd4266b0da4887701e0ce0860faded96768.zip |
Reset published date on publish
Diffstat (limited to 'server/lib/job-queue/handlers')
-rw-r--r-- | server/lib/job-queue/handlers/video-file.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/server/lib/job-queue/handlers/video-file.ts b/server/lib/job-queue/handlers/video-file.ts index a5c6bf300..fc40527c7 100644 --- a/server/lib/job-queue/handlers/video-file.ts +++ b/server/lib/job-queue/handlers/video-file.ts | |||
@@ -71,13 +71,18 @@ async function onVideoFileTranscoderOrImportSuccess (video: VideoModel) { | |||
71 | // Video does not exist anymore | 71 | // Video does not exist anymore |
72 | if (!videoDatabase) return undefined | 72 | if (!videoDatabase) return undefined |
73 | 73 | ||
74 | let isNewVideo = false | ||
75 | |||
74 | // We transcoded the video file in another format, now we can publish it | 76 | // We transcoded the video file in another format, now we can publish it |
75 | const oldState = videoDatabase.state | 77 | if (videoDatabase.state !== VideoState.PUBLISHED) { |
76 | videoDatabase.state = VideoState.PUBLISHED | 78 | isNewVideo = true |
77 | videoDatabase = await videoDatabase.save({ transaction: t }) | 79 | |
80 | videoDatabase.state = VideoState.PUBLISHED | ||
81 | videoDatabase.publishedAt = new Date() | ||
82 | videoDatabase = await videoDatabase.save({ transaction: t }) | ||
83 | } | ||
78 | 84 | ||
79 | // If the video was not published, we consider it is a new one for other instances | 85 | // If the video was not published, we consider it is a new one for other instances |
80 | const isNewVideo = oldState !== VideoState.PUBLISHED | ||
81 | await federateVideoIfNeeded(videoDatabase, isNewVideo, t) | 86 | await federateVideoIfNeeded(videoDatabase, isNewVideo, t) |
82 | 87 | ||
83 | return undefined | 88 | return undefined |