aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-28 16:58:15 +0200
committerChocobozzz <me@florianbigard.com>2018-06-28 16:58:15 +0200
commit1b952dd4266b0da4887701e0ce0860faded96768 (patch)
treefa49ac70a58ea5af94f39b68c7c135ca0d22c815
parent6454845e2f7c44fdc6d4973c4b3daa9969ffab23 (diff)
downloadPeerTube-1b952dd4266b0da4887701e0ce0860faded96768.tar.gz
PeerTube-1b952dd4266b0da4887701e0ce0860faded96768.tar.zst
PeerTube-1b952dd4266b0da4887701e0ce0860faded96768.zip
Reset published date on publish
-rw-r--r--client/src/assets/player/webtorrent-info-button.ts2
-rw-r--r--server/lib/job-queue/handlers/video-file.ts13
2 files changed, 10 insertions, 5 deletions
diff --git a/client/src/assets/player/webtorrent-info-button.ts b/client/src/assets/player/webtorrent-info-button.ts
index 5f3e80c79..deef253ce 100644
--- a/client/src/assets/player/webtorrent-info-button.ts
+++ b/client/src/assets/player/webtorrent-info-button.ts
@@ -80,7 +80,7 @@ class WebtorrentInfoButton extends Button {
80 const totalUploaded = bytes(data.uploaded) 80 const totalUploaded = bytes(data.uploaded)
81 const numPeers = data.numPeers 81 const numPeers = data.numPeers
82 82
83 subDivWebtorrent.title = this.player_.localize('Total Downloaded: ') + totalDownloaded.join(' ') + '\n' + 83 subDivWebtorrent.title = this.player_.localize('Total downloaded: ') + totalDownloaded.join(' ') + '\n' +
84 this.player_.localize('Total uploaded: ' + totalUploaded.join(' ')) 84 this.player_.localize('Total uploaded: ' + totalUploaded.join(' '))
85 85
86 downloadSpeedNumber.textContent = downloadSpeed[ 0 ] 86 downloadSpeedNumber.textContent = downloadSpeed[ 0 ]
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