mirror of https://github.com/Chocobozzz/PeerTube
Fix video channel description/support max length
parent
360329cc02
commit
a10fc78bb0
|
@ -15,20 +15,20 @@ export const VIDEO_CHANNEL_DISPLAY_NAME = {
|
||||||
export const VIDEO_CHANNEL_DESCRIPTION = {
|
export const VIDEO_CHANNEL_DESCRIPTION = {
|
||||||
VALIDATORS: [
|
VALIDATORS: [
|
||||||
Validators.minLength(3),
|
Validators.minLength(3),
|
||||||
Validators.maxLength(250)
|
Validators.maxLength(500)
|
||||||
],
|
],
|
||||||
MESSAGES: {
|
MESSAGES: {
|
||||||
'minlength': 'Description must be at least 3 characters long.',
|
'minlength': 'Description must be at least 3 characters long.',
|
||||||
'maxlength': 'Description cannot be more than 250 characters long.'
|
'maxlength': 'Description cannot be more than 500 characters long.'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export const VIDEO_CHANNEL_SUPPORT = {
|
export const VIDEO_CHANNEL_SUPPORT = {
|
||||||
VALIDATORS: [
|
VALIDATORS: [
|
||||||
Validators.minLength(3),
|
Validators.minLength(3),
|
||||||
Validators.maxLength(300)
|
Validators.maxLength(500)
|
||||||
],
|
],
|
||||||
MESSAGES: {
|
MESSAGES: {
|
||||||
'minlength': 'Support text must be at least 3 characters long.',
|
'minlength': 'Support text must be at least 3 characters long.',
|
||||||
'maxlength': 'Support text cannot be more than 300 characters long.'
|
'maxlength': 'Support text cannot be more than 500 characters long.'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,9 +60,9 @@ export const VIDEO_TAGS = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const VIDEO_SUPPORT = {
|
export const VIDEO_SUPPORT = {
|
||||||
VALIDATORS: [ Validators.minLength(3), Validators.maxLength(300) ],
|
VALIDATORS: [ Validators.minLength(3), Validators.maxLength(500) ],
|
||||||
MESSAGES: {
|
MESSAGES: {
|
||||||
'minlength': 'Video support must be at least 3 characters long.',
|
'minlength': 'Video support must be at least 3 characters long.',
|
||||||
'maxlength': 'Video support cannot be more than 300 characters long.'
|
'maxlength': 'Video support cannot be more than 500 characters long.'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ let config: IConfig = require('config')
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const LAST_MIGRATION_VERSION = 210
|
const LAST_MIGRATION_VERSION = 215
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -192,8 +192,8 @@ const CONSTRAINTS_FIELDS = {
|
||||||
},
|
},
|
||||||
VIDEO_CHANNELS: {
|
VIDEO_CHANNELS: {
|
||||||
NAME: { min: 3, max: 120 }, // Length
|
NAME: { min: 3, max: 120 }, // Length
|
||||||
DESCRIPTION: { min: 3, max: 250 }, // Length
|
DESCRIPTION: { min: 3, max: 500 }, // Length
|
||||||
SUPPORT: { min: 3, max: 300 }, // Length
|
SUPPORT: { min: 3, max: 500 }, // Length
|
||||||
URL: { min: 3, max: 2000 } // Length
|
URL: { min: 3, max: 2000 } // Length
|
||||||
},
|
},
|
||||||
VIDEOS: {
|
VIDEOS: {
|
||||||
|
@ -201,7 +201,7 @@ const CONSTRAINTS_FIELDS = {
|
||||||
LANGUAGE: { min: 1, max: 10 }, // Length
|
LANGUAGE: { min: 1, max: 10 }, // Length
|
||||||
TRUNCATED_DESCRIPTION: { min: 3, max: 250 }, // Length
|
TRUNCATED_DESCRIPTION: { min: 3, max: 250 }, // Length
|
||||||
DESCRIPTION: { min: 3, max: 10000 }, // Length
|
DESCRIPTION: { min: 3, max: 10000 }, // Length
|
||||||
SUPPORT: { min: 3, max: 300 }, // Length
|
SUPPORT: { min: 3, max: 500 }, // Length
|
||||||
IMAGE: {
|
IMAGE: {
|
||||||
EXTNAME: [ '.jpg', '.jpeg' ],
|
EXTNAME: [ '.jpg', '.jpeg' ],
|
||||||
FILE_SIZE: {
|
FILE_SIZE: {
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
import * as Sequelize from 'sequelize'
|
||||||
|
import { CONSTRAINTS_FIELDS } from '../index'
|
||||||
|
|
||||||
|
async function up (utils: {
|
||||||
|
transaction: Sequelize.Transaction,
|
||||||
|
queryInterface: Sequelize.QueryInterface,
|
||||||
|
sequelize: Sequelize.Sequelize
|
||||||
|
}): Promise<void> {
|
||||||
|
{
|
||||||
|
const data = {
|
||||||
|
type: Sequelize.STRING(500),
|
||||||
|
allowNull: true,
|
||||||
|
defaultValue: null
|
||||||
|
}
|
||||||
|
await utils.queryInterface.changeColumn('video', 'support', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const data = {
|
||||||
|
type: Sequelize.STRING(500),
|
||||||
|
allowNull: true,
|
||||||
|
defaultValue: null
|
||||||
|
}
|
||||||
|
await utils.queryInterface.changeColumn('videoChannel', 'support', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const data = {
|
||||||
|
type: Sequelize.STRING(500),
|
||||||
|
allowNull: true,
|
||||||
|
defaultValue: null
|
||||||
|
}
|
||||||
|
await utils.queryInterface.changeColumn('videoChannel', 'description', data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function down (options) {
|
||||||
|
throw new Error('Not implemented.')
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
up,
|
||||||
|
down
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
import {
|
import {
|
||||||
AllowNull, BeforeDestroy, BelongsTo, Column, CreatedAt, DefaultScope, ForeignKey, HasMany, Is, Model, Scopes, Table,
|
AllowNull, BeforeDestroy, BelongsTo, Column, CreatedAt, DefaultScope, ForeignKey, HasMany, Is, Model, Scopes, Table,
|
||||||
UpdatedAt, Default
|
UpdatedAt, Default, DataType
|
||||||
} from 'sequelize-typescript'
|
} from 'sequelize-typescript'
|
||||||
import { ActivityPubActor } from '../../../shared/models/activitypub'
|
import { ActivityPubActor } from '../../../shared/models/activitypub'
|
||||||
import { VideoChannel } from '../../../shared/models/videos'
|
import { VideoChannel } from '../../../shared/models/videos'
|
||||||
|
@ -14,6 +14,7 @@ import { AccountModel } from '../account/account'
|
||||||
import { ActorModel } from '../activitypub/actor'
|
import { ActorModel } from '../activitypub/actor'
|
||||||
import { getSort, throwIfNotValid } from '../utils'
|
import { getSort, throwIfNotValid } from '../utils'
|
||||||
import { VideoModel } from './video'
|
import { VideoModel } from './video'
|
||||||
|
import { CONSTRAINTS_FIELDS } from '../../initializers'
|
||||||
|
|
||||||
enum ScopeNames {
|
enum ScopeNames {
|
||||||
WITH_ACCOUNT = 'WITH_ACCOUNT',
|
WITH_ACCOUNT = 'WITH_ACCOUNT',
|
||||||
|
@ -73,13 +74,13 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is('VideoChannelDescription', value => throwIfNotValid(value, isVideoChannelDescriptionValid, 'description'))
|
@Is('VideoChannelDescription', value => throwIfNotValid(value, isVideoChannelDescriptionValid, 'description'))
|
||||||
@Column
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNELS.DESCRIPTION.max))
|
||||||
description: string
|
description: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is('VideoChannelSupport', value => throwIfNotValid(value, isVideoChannelSupportValid, 'support'))
|
@Is('VideoChannelSupport', value => throwIfNotValid(value, isVideoChannelSupportValid, 'support'))
|
||||||
@Column
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNELS.SUPPORT.max))
|
||||||
support: string
|
support: string
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
|
|
Loading…
Reference in New Issue