]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Reset published date on publish
authorChocobozzz <me@florianbigard.com>
Thu, 28 Jun 2018 14:58:15 +0000 (16:58 +0200)
committerChocobozzz <me@florianbigard.com>
Thu, 28 Jun 2018 14:58:15 +0000 (16:58 +0200)
client/src/assets/player/webtorrent-info-button.ts
server/lib/job-queue/handlers/video-file.ts

index 5f3e80c7994dbac73735fc00858e154631de3fe9..deef253ceab4207387cafb988d958caece9ae583 100644 (file)
@@ -80,7 +80,7 @@ class WebtorrentInfoButton extends Button {
       const totalUploaded = bytes(data.uploaded)
       const numPeers = data.numPeers
 
-      subDivWebtorrent.title = this.player_.localize('Total Downloaded: ') + totalDownloaded.join(' ') + '\n' +
+      subDivWebtorrent.title = this.player_.localize('Total downloaded: ') + totalDownloaded.join(' ') + '\n' +
         this.player_.localize('Total uploaded: ' + totalUploaded.join(' '))
 
       downloadSpeedNumber.textContent = downloadSpeed[ 0 ]
index a5c6bf3007f02be32c75600203baa302d58903ea..fc40527c7ab1c68573a0de5e31f5515cd3f411a9 100644 (file)
@@ -71,13 +71,18 @@ async function onVideoFileTranscoderOrImportSuccess (video: VideoModel) {
     // Video does not exist anymore
     if (!videoDatabase) return undefined
 
+    let isNewVideo = false
+
     // We transcoded the video file in another format, now we can publish it
-    const oldState = videoDatabase.state
-    videoDatabase.state = VideoState.PUBLISHED
-    videoDatabase = await videoDatabase.save({ transaction: t })
+    if (videoDatabase.state !== VideoState.PUBLISHED) {
+      isNewVideo = true
+
+      videoDatabase.state = VideoState.PUBLISHED
+      videoDatabase.publishedAt = new Date()
+      videoDatabase = await videoDatabase.save({ transaction: t })
+    }
 
     // If the video was not published, we consider it is a new one for other instances
-    const isNewVideo = oldState !== VideoState.PUBLISHED
     await federateVideoIfNeeded(videoDatabase, isNewVideo, t)
 
     return undefined