nsfw: video.nsfw,
waitTranscoding: video.waitTranscoding,
commentsEnabled: video.commentsEnabled,
+ downloadEnabled: video.downloadEnabled,
thumbnailfile: video.thumbnailfile,
previewfile: video.previewfile,
- scheduleUpdate
+ scheduleUpdate,
+ originallyPublishedAt
}
}
uuid?: string
id?: number
scheduleUpdate?: VideoScheduleUpdate
+ originallyPublishedAt?: Date | string
- constructor (video?: Video & { tags: string[], commentsEnabled: boolean, support: string, thumbnailUrl: string, previewUrl: string }) {
+ constructor (
+ video?: Video & {
+ tags: string[],
+ commentsEnabled: boolean,
+ downloadEnabled: boolean,
+ support: string,
+ thumbnailUrl: string,
+ previewUrl: string
+ }) {
if (video) {
this.id = video.id
this.uuid = video.uuid
tags: this.tags,
nsfw: this.nsfw,
commentsEnabled: this.commentsEnabled,
+ downloadEnabled: this.downloadEnabled,
waitTranscoding: this.waitTranscoding,
channelId: this.channelId,
- privacy: this.privacy
+ privacy: this.privacy,
+ originallyPublishedAt: this.originallyPublishedAt
}
// Special case if we scheduled an update
nsfw: video.nsfw,
waitTranscoding: video.waitTranscoding,
commentsEnabled: video.commentsEnabled,
+ downloadEnabled: video.downloadEnabled,
thumbnailfile: video.thumbnailfile,
previewfile: video.previewfile,
- scheduleUpdate
+ scheduleUpdate,
+ originallyPublishedAt
}
const data = objectToFormData(body)
<span i18n class="video-attribute-label">Privacy</span>
<span class="video-attribute-value">{{ video.privacy.label }}</span>
</div>
- <div class="video-attribute">
- <span i18n class="video-attribute-label">Originally published on</span>
- <span *ngIf="!video.originallyPublishedAt" class="video-attribute-value">Unknown</span>
- <span *ngIf="video.originallyPublishedAt" class="video-attribute-value">
- {{ video.originallyPublishedAt | date: 'dd MMMM yyyy' }}
- </span>
+
++ <div *ngIf="!!video.originallyPublishedAt" class="video-attribute">
++ <span i18n class="video-attribute-label">Originally published</span>
++ <span class="video-attribute-value">{{ video.originallyPublishedAt | date: 'dd MMMM yyyy' }}</span>
+ </div>
<div class="video-attribute">
<span i18n class="video-attribute-label">Category</span>
margin-bottom: 12px;
.video-attribute-label {
- min-width: 91px;
+ min-width: 142px;
padding-right: 5px;
display: inline-block;
- color: #585858;
+ color: $grey-foreground-color;
font-weight: $font-bold;
}
if (videoInfoToUpdate.support !== undefined) videoInstance.set('support', videoInfoToUpdate.support)
if (videoInfoToUpdate.description !== undefined) videoInstance.set('description', videoInfoToUpdate.description)
if (videoInfoToUpdate.commentsEnabled !== undefined) videoInstance.set('commentsEnabled', videoInfoToUpdate.commentsEnabled)
- if (videoInfoToUpdate.originallyPublishedAt !== undefined &&
- videoInfoToUpdate.originallyPublishedAt !== null) {
+ if (videoInfoToUpdate.downloadEnabled !== undefined) videoInstance.set('downloadEnabled', videoInfoToUpdate.downloadEnabled)
++
++ if (videoInfoToUpdate.originallyPublishedAt !== undefined && videoInfoToUpdate.originallyPublishedAt !== null) {
+ videoInstance.set('originallyPublishedAt', videoInfoToUpdate.originallyPublishedAt)
+ }
+
if (videoInfoToUpdate.privacy !== undefined) {
const newPrivacy = parseInt(videoInfoToUpdate.privacy.toString(), 10)
videoInstance.set('privacy', newPrivacy)
// ---------------------------------------------------------------------------
- const LAST_MIGRATION_VERSION = 315
-const LAST_MIGRATION_VERSION = 335
++const LAST_MIGRATION_VERSION = 340
// ---------------------------------------------------------------------------
--- /dev/null
-
- // Sequelize does not alter the column with NOW as default value
- {
- const data = {
- type: Sequelize.DATE,
- allowNull: false,
- defaultValue: Sequelize.NOW
- }
- await utils.queryInterface.changeColumn('video', 'originallyPublishedAt', data)
- }
-
+import * as Sequelize from 'sequelize'
+
+async function up (utils: {
+ transaction: Sequelize.Transaction,
+ queryInterface: Sequelize.QueryInterface,
+ sequelize: Sequelize.Sequelize
+}): Promise<void> {
+
+ {
+ const data = {
+ type: Sequelize.DATE,
+ allowNull: true,
+ defaultValue: Sequelize.NOW
+ }
+ await utils.queryInterface.addColumn('video', 'originallyPublishedAt', data)
+ }
+
+ {
+ const query = 'UPDATE video SET "originallyPublishedAt" = video."publishedAt"'
+ await utils.sequelize.query(query)
+ }
+}
+
+function down (options) {
+ throw new Error('Not implemented.')
+}
+
+export {
+ up,
+ down
+}
.optional()
.toBoolean()
.custom(isBooleanValid).withMessage('Should have comments enabled boolean'),
- body('originallyPublishedAt')
+ body('downloadEnabled')
.optional()
- .customSanitizer(toValueOrNull)
- .custom(isVideoOriginallyPublishedAtValid).withMessage('Should have a valid original publication date'),
-
+ .toBoolean()
+ .custom(isBooleanValid).withMessage('Should have downloading enabled boolean'),
-
++ body('originallyPublishedAt')
++ .optional()
++ .customSanitizer(toValueOrNull)
++ .custom(isVideoOriginallyPublishedAtValid).withMessage('Should have a valid original publication date'),
body('scheduleUpdate')
.optional()
.customSanitizer(toValueOrNull),
waitTranscoding: video.waitTranscoding,
state: video.state,
commentsEnabled: video.commentsEnabled,
+ downloadEnabled: video.downloadEnabled,
published: video.publishedAt.toISOString(),
+ originallyPublishedAt: video.originallyPublishedAt ?
+ video.originallyPublishedAt.toISOString() :
+ null,
updated: video.updatedAt.toISOString(),
mediaType: 'text/markdown',
content: video.getTruncatedDescription(),
name: string
tags?: string[]
commentsEnabled?: boolean
+ downloadEnabled?: boolean
privacy: VideoPrivacy
scheduleUpdate?: VideoScheduleUpdate
+ originallyPublishedAt: Date | string
}