expires: 'sc:expires',
support: 'sc:Text',
CacheFile: 'pt:CacheFile',
- Infohash: 'pt:Infohash'
+ Infohash: 'pt:Infohash',
+ originallyPublishedAt: 'sc:DateTime'
},
{
likes: {
isBooleanValid(video.downloadEnabled) &&
isDateValid(video.published) &&
isDateValid(video.updated) &&
+ (!video.originallyPublishedAt || isDateValid(video.originallyPublishedAt)) &&
(!video.content || isRemoteVideoContentValid(video.mediaType, video.content)) &&
isRemoteVideoIconValid(video.icon) &&
video.url.length !== 0 &&
options.video.set('duration', videoData.duration)
options.video.set('createdAt', videoData.createdAt)
options.video.set('publishedAt', videoData.publishedAt)
+ options.video.set('originallyPublishedAt', videoData.originallyPublishedAt)
options.video.set('privacy', videoData.privacy)
options.video.set('channelId', videoData.channelId)
options.video.set('views', videoData.views)
duration: parseInt(duration, 10),
createdAt: new Date(videoObject.published),
publishedAt: new Date(videoObject.published),
+ originallyPublishedAt: videoObject.originallyPublishedAt ? new Date(videoObject.originallyPublishedAt) : null,
// FIXME: updatedAt does not seems to be considered by Sequelize
updatedAt: new Date(videoObject.updated),
views: videoObject.views,
commentsEnabled: video.commentsEnabled,
downloadEnabled: video.downloadEnabled,
published: video.publishedAt.toISOString(),
- originallyPublishedAt: video.originallyPublishedAt ?
- video.originallyPublishedAt.toISOString() :
- null,
+ originallyPublishedAt: video.originallyPublishedAt ? video.originallyPublishedAt.toISOString() : null,
updated: video.updatedAt.toISOString(),
mediaType: 'text/markdown',
content: video.getTruncatedDescription(),
isVideoDurationValid,
isVideoLanguageValid,
isVideoLicenceValid,
- isVideoNameValid,
+ isVideoNameValid, isVideoOriginallyPublishedAtValid,
isVideoPrivacyValid,
isVideoStateValid,
isVideoSupportValid
{ fields: [ 'createdAt' ] },
{ fields: [ 'publishedAt' ] },
- { fields: [ 'originallyPublishedAt' ] },
{ fields: [ 'duration' ] },
{ fields: [ 'views' ] },
{ fields: [ 'channelId' ] },
+ {
+ fields: [ 'originallyPublishedAt' ],
+ where: {
+ originallyPublishedAt: {
+ [Sequelize.Op.ne]: null
+ }
+ }
+ },
{
fields: [ 'category' ], // We don't care videos with an unknown category
where: {
@Column
publishedAt: Date
+ @AllowNull(true)
+ @Default(null)
@Column
originallyPublishedAt: Date
support: 'my super support text',
tags: [ 'tag1', 'tag2' ],
privacy: VideoPrivacy.PUBLIC,
- channelId: channelId
+ channelId: channelId,
+ originallyPublishedAt: new Date().toISOString()
}
})
await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
})
+ it('Should fail with a bad originally published at attribute', async function () {
+ const fields = immutableAssign(baseCorrectParams, { 'originallyPublishedAt': 'toto' })
+ const attaches = baseCorrectAttaches
+
+ await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
+ })
+
it('Should fail without an input file', async function () {
const fields = baseCorrectParams
const attaches = {}
await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })
})
+ it('Should fail with a bad originally published at param', async function () {
+ const fields = immutableAssign(baseCorrectParams, { originallyPublishedAt: 'toto' })
+
+ await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })
+ })
+
it('Should fail with an incorrect thumbnail file', async function () {
const fields = baseCorrectParams
const attaches = {
nsfw: true,
description: 'my super description for server 1',
support: 'my super support text for server 1',
+ originallyPublishedAt: '2019-02-10T13:38:14.449Z',
tags: [ 'tag1p1', 'tag2p1' ],
channelId: videoChannelId,
fixture: 'video_short1.webm'
nsfw: true,
description: 'my super description for server 1',
support: 'my super support text for server 1',
+ originallyPublishedAt: '2019-02-10T13:38:14.449Z',
account: {
name: 'root',
host: 'localhost:9001'
support: 'my super support text updated',
tags: [ 'tag_up_1', 'tag_up_2' ],
thumbnailfile: 'thumbnail.jpg',
+ originallyPublishedAt: '2019-02-11T13:38:14.449Z',
previewfile: 'preview.jpg'
}
nsfw: true,
description: 'my super description updated',
support: 'my super support text updated',
+ originallyPublishedAt: '2019-02-11T13:38:14.449Z',
account: {
name: 'root',
host: 'localhost:9003'
isLocal,
duration: 5,
commentsEnabled: false,
- downloadEnabled: false,
+ downloadEnabled: true,
tags: [ ],
privacy: VideoPrivacy.PUBLIC,
channel: {
downloadEnabled?: boolean
waitTranscoding?: boolean
description?: string
+ originallyPublishedAt?: string
tags?: string[]
channelId?: number
privacy?: VideoPrivacy
if (attributes.licence !== undefined) {
req.field('licence', attributes.licence.toString())
}
+ if (attributes.originallyPublishedAt !== undefined) {
+ req.field('originallyPublishedAt', attributes.originallyPublishedAt)
+ }
for (let i = 0; i < attributes.tags.length; i++) {
req.field('tags[' + i + ']', attributes.tags[i])
if (attributes.nsfw !== undefined) body['nsfw'] = JSON.stringify(attributes.nsfw)
if (attributes.commentsEnabled !== undefined) body['commentsEnabled'] = JSON.stringify(attributes.commentsEnabled)
if (attributes.downloadEnabled !== undefined) body['downloadEnabled'] = JSON.stringify(attributes.downloadEnabled)
+ if (attributes.originallyPublishedAt !== undefined) body['originallyPublishedAt'] = attributes.originallyPublishedAt
if (attributes.description) body['description'] = attributes.description
if (attributes.tags) body['tags'] = attributes.tags
if (attributes.privacy) body['privacy'] = attributes.privacy
description: string
publishedAt?: string
support: string
+ originallyPublishedAt?: string,
account: {
name: string
host: string
expect(video.publishedAt).to.equal(attributes.publishedAt)
}
+ if (attributes.originallyPublishedAt) {
+ expect(video.originallyPublishedAt).to.equal(attributes.originallyPublishedAt)
+ } else {
+ expect(video.originallyPublishedAt).to.be.null
+ }
+
const res = await getVideo(url, video.uuid)
const videoDetails: VideoDetails = res.body