]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/video.ts
Fix lint
[github/Chocobozzz/PeerTube.git] / server / models / video / video.ts
index 874ad168a1325418154a973b1035ebb527829f82..d2daf18ee573ecae7d3b0875ae83dc465c5b57b0 100644 (file)
@@ -1,4 +1,4 @@
-import * as Bluebird from 'bluebird'
+import Bluebird from 'bluebird'
 import { remove } from 'fs-extra'
 import { maxBy, minBy } from 'lodash'
 import { join } from 'path'
@@ -1766,12 +1766,12 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
       this.privacy === VideoPrivacy.INTERNAL
   }
 
-  async setNewState (newState: VideoState, transaction: Transaction) {
+  async setNewState (newState: VideoState, isNewVideo: boolean, transaction: Transaction) {
     if (this.state === newState) throw new Error('Cannot use same state ' + newState)
 
     this.state = newState
 
-    if (this.state === VideoState.PUBLISHED) {
+    if (this.state === VideoState.PUBLISHED && isNewVideo) {
       this.publishedAt = new Date()
     }