Add video attribute "importedFrom"
This commit is contained in:
parent
ae0e4fdbd1
commit
2d435c685e
|
@ -18,6 +18,18 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="!!video.importedFrom" class="attribute attribute-imported-from">
|
||||||
|
<span i18n class="attribute-label">Imported from</span>
|
||||||
|
<a
|
||||||
|
class="attribute-value"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
[href]="video.importedFrom"
|
||||||
|
>
|
||||||
|
{{ video.importedFrom }}<my-global-icon iconName="external-link"></my-global-icon>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div *ngIf="!!video.originallyPublishedAt" class="attribute attribute-originally-published-at">
|
<div *ngIf="!!video.originallyPublishedAt" class="attribute attribute-originally-published-at">
|
||||||
<span i18n class="attribute-label">Originally published</span>
|
<span i18n class="attribute-label">Originally published</span>
|
||||||
<span class="attribute-value">{{ video.originallyPublishedAt | date: 'dd MMMM yyyy' }}</span>
|
<span class="attribute-value">{{ video.originallyPublishedAt | date: 'dd MMMM yyyy' }}</span>
|
||||||
|
|
|
@ -28,6 +28,7 @@ export class Video implements VideoServerModel {
|
||||||
createdAt: Date
|
createdAt: Date
|
||||||
updatedAt: Date
|
updatedAt: Date
|
||||||
publishedAt: Date
|
publishedAt: Date
|
||||||
|
importedFrom: string
|
||||||
originallyPublishedAt: Date | string
|
originallyPublishedAt: Date | string
|
||||||
category: VideoConstant<number>
|
category: VideoConstant<number>
|
||||||
licence: VideoConstant<number>
|
licence: VideoConstant<number>
|
||||||
|
@ -185,6 +186,7 @@ export class Video implements VideoServerModel {
|
||||||
this.privacy.label = peertubeTranslate(this.privacy.label, translations)
|
this.privacy.label = peertubeTranslate(this.privacy.label, translations)
|
||||||
|
|
||||||
this.scheduledUpdate = hash.scheduledUpdate
|
this.scheduledUpdate = hash.scheduledUpdate
|
||||||
|
this.importedFrom = hash.importedFrom
|
||||||
this.originallyPublishedAt = hash.originallyPublishedAt ? new Date(hash.originallyPublishedAt.toString()) : null
|
this.originallyPublishedAt = hash.originallyPublishedAt ? new Date(hash.originallyPublishedAt.toString()) : null
|
||||||
|
|
||||||
if (this.state) this.state.label = peertubeTranslate(this.state.label, translations)
|
if (this.state) this.state.label = peertubeTranslate(this.state.label, translations)
|
||||||
|
|
|
@ -26,7 +26,7 @@ import { CONFIG, registerConfigChangedHandler } from './config'
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const LAST_MIGRATION_VERSION = 755
|
const LAST_MIGRATION_VERSION = 756
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
import * as Sequelize from 'sequelize'
|
||||||
|
|
||||||
|
async function up (utils: {
|
||||||
|
transaction: Sequelize.Transaction
|
||||||
|
queryInterface: Sequelize.QueryInterface
|
||||||
|
sequelize: Sequelize.Sequelize
|
||||||
|
}): Promise<void> {
|
||||||
|
await utils.sequelize.query(`
|
||||||
|
ALTER TABLE "video"
|
||||||
|
ADD COLUMN "importedFrom"
|
||||||
|
varchar(2000)
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function down (utils: {}) {
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
up,
|
||||||
|
down
|
||||||
|
}
|
|
@ -122,6 +122,7 @@ function videoModelToFormattedJSON (video: MVideoFormattable, options: VideoForm
|
||||||
createdAt: video.createdAt,
|
createdAt: video.createdAt,
|
||||||
updatedAt: video.updatedAt,
|
updatedAt: video.updatedAt,
|
||||||
publishedAt: video.publishedAt,
|
publishedAt: video.publishedAt,
|
||||||
|
importedFrom: video.importedFrom,
|
||||||
originallyPublishedAt: video.originallyPublishedAt,
|
originallyPublishedAt: video.originallyPublishedAt,
|
||||||
|
|
||||||
isLive: video.isLive,
|
isLive: video.isLive,
|
||||||
|
|
|
@ -260,6 +260,7 @@ export class VideoTableAttributes {
|
||||||
'waitTranscoding',
|
'waitTranscoding',
|
||||||
'state',
|
'state',
|
||||||
'publishedAt',
|
'publishedAt',
|
||||||
|
'importedFrom',
|
||||||
'originallyPublishedAt',
|
'originallyPublishedAt',
|
||||||
'channelId',
|
'channelId',
|
||||||
'createdAt',
|
'createdAt',
|
||||||
|
|
|
@ -549,6 +549,11 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
|
||||||
@Column
|
@Column
|
||||||
publishedAt: Date
|
publishedAt: Date
|
||||||
|
|
||||||
|
@AllowNull(true)
|
||||||
|
@Default(null)
|
||||||
|
@Column
|
||||||
|
importedFrom: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column
|
@Column
|
||||||
|
|
|
@ -15,6 +15,7 @@ export interface Video {
|
||||||
createdAt: Date | string
|
createdAt: Date | string
|
||||||
updatedAt: Date | string
|
updatedAt: Date | string
|
||||||
publishedAt: Date | string
|
publishedAt: Date | string
|
||||||
|
importedFrom: string
|
||||||
originallyPublishedAt: Date | string
|
originallyPublishedAt: Date | string
|
||||||
category: VideoConstant<number>
|
category: VideoConstant<number>
|
||||||
licence: VideoConstant<number>
|
licence: VideoConstant<number>
|
||||||
|
|
|
@ -2530,6 +2530,9 @@ paths:
|
||||||
downloadEnabled:
|
downloadEnabled:
|
||||||
description: Enable or disable downloading for this video
|
description: Enable or disable downloading for this video
|
||||||
type: boolean
|
type: boolean
|
||||||
|
importedFrom:
|
||||||
|
description: The URL where this video is imported from
|
||||||
|
type: string
|
||||||
originallyPublishedAt:
|
originallyPublishedAt:
|
||||||
description: Date when the content was originally published
|
description: Date when the content was originally published
|
||||||
type: string
|
type: string
|
||||||
|
|
Loading…
Reference in New Issue