-import * as Bluebird from 'bluebird'
+import Bluebird from 'bluebird'
import { remove } from 'fs-extra'
import { maxBy, minBy } from 'lodash'
import { join } from 'path'
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()
}