Add video attribute "importedFrom"
This commit is contained in:
parent
ae0e4fdbd1
commit
2d435c685e
|
@ -18,6 +18,18 @@
|
|||
</a>
|
||||
</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">
|
||||
<span i18n class="attribute-label">Originally published</span>
|
||||
<span class="attribute-value">{{ video.originallyPublishedAt | date: 'dd MMMM yyyy' }}</span>
|
||||
|
|
|
@ -28,6 +28,7 @@ export class Video implements VideoServerModel {
|
|||
createdAt: Date
|
||||
updatedAt: Date
|
||||
publishedAt: Date
|
||||
importedFrom: string
|
||||
originallyPublishedAt: Date | string
|
||||
category: VideoConstant<number>
|
||||
licence: VideoConstant<number>
|
||||
|
@ -185,6 +186,7 @@ export class Video implements VideoServerModel {
|
|||
this.privacy.label = peertubeTranslate(this.privacy.label, translations)
|
||||
|
||||
this.scheduledUpdate = hash.scheduledUpdate
|
||||
this.importedFrom = hash.importedFrom
|
||||
this.originallyPublishedAt = hash.originallyPublishedAt ? new Date(hash.originallyPublishedAt.toString()) : null
|
||||
|
||||
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,
|
||||
updatedAt: video.updatedAt,
|
||||
publishedAt: video.publishedAt,
|
||||
importedFrom: video.importedFrom,
|
||||
originallyPublishedAt: video.originallyPublishedAt,
|
||||
|
||||
isLive: video.isLive,
|
||||
|
|
|
@ -260,6 +260,7 @@ export class VideoTableAttributes {
|
|||
'waitTranscoding',
|
||||
'state',
|
||||
'publishedAt',
|
||||
'importedFrom',
|
||||
'originallyPublishedAt',
|
||||
'channelId',
|
||||
'createdAt',
|
||||
|
|
|
@ -549,6 +549,11 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
|
|||
@Column
|
||||
publishedAt: Date
|
||||
|
||||
@AllowNull(true)
|
||||
@Default(null)
|
||||
@Column
|
||||
importedFrom: string
|
||||
|
||||
@AllowNull(true)
|
||||
@Default(null)
|
||||
@Column
|
||||
|
|
|
@ -15,6 +15,7 @@ export interface Video {
|
|||
createdAt: Date | string
|
||||
updatedAt: Date | string
|
||||
publishedAt: Date | string
|
||||
importedFrom: string
|
||||
originallyPublishedAt: Date | string
|
||||
category: VideoConstant<number>
|
||||
licence: VideoConstant<number>
|
||||
|
|
|
@ -2530,6 +2530,9 @@ paths:
|
|||
downloadEnabled:
|
||||
description: Enable or disable downloading for this video
|
||||
type: boolean
|
||||
importedFrom:
|
||||
description: The URL where this video is imported from
|
||||
type: string
|
||||
originallyPublishedAt:
|
||||
description: Date when the content was originally published
|
||||
type: string
|
||||
|
|
Loading…
Reference in New Issue