diff --git a/server/controllers/api/videos.js b/server/controllers/api/videos.js index dfd8699e6..5a67d1121 100644 --- a/server/controllers/api/videos.js +++ b/server/controllers/api/videos.js @@ -155,7 +155,8 @@ function addVideo (req, res, videoFile, finalCallback) { extname: path.extname(videoFile.filename), description: videoInfos.description, duration: videoFile.duration, - authorId: author.id + authorId: author.id, + views: videoInfos.views } const video = db.Video.build(videoData) diff --git a/server/helpers/custom-validators/remote/videos.js b/server/helpers/custom-validators/remote/videos.js index c1786014d..ba2d0bb93 100644 --- a/server/helpers/custom-validators/remote/videos.js +++ b/server/helpers/custom-validators/remote/videos.js @@ -91,7 +91,8 @@ function isCommonVideoAttributesValid (video) { videosValidators.isVideoNameValid(video.name) && videosValidators.isVideoTagsValid(video.tags) && videosValidators.isVideoRemoteIdValid(video.remoteId) && - videosValidators.isVideoExtnameValid(video.extname) + videosValidators.isVideoExtnameValid(video.extname) && + videosValidators.isVideoViewsValid(video.views) } function isRequestTypeAddValid (value) { diff --git a/server/models/video.js b/server/models/video.js index daa273845..fb46aca86 100644 --- a/server/models/video.js +++ b/server/models/video.js @@ -380,7 +380,8 @@ function toAddRemoteJSON (callback) { tags: map(self.Tags, 'name'), createdAt: self.createdAt, updatedAt: self.updatedAt, - extname: self.extname + extname: self.extname, + views: self.views } return callback(null, remoteVideo) @@ -398,7 +399,8 @@ function toUpdateRemoteJSON (callback) { tags: map(this.Tags, 'name'), createdAt: this.createdAt, updatedAt: this.updatedAt, - extname: this.extname + extname: this.extname, + views: this.views } return json