* fix migrations to not use config constant values as it can introduce bugs later when they change; (fixes #1259)
remove constant fields imports from migrations
* add migrations to update description and support fields to 1000 (fixes #1258)
* fix client/server account and video_channel description/support fields to be max len 1000 (fixes #1258);
fix test Should fail with a too long description;
fix test Should fail with a long description;
fix test Should fail with a long description;
Remove USER.SUPPORT from constants since that field no longer exists;
null not false, in migrations/0280-description-support.ts;
video support field 1000, oops;
* rename migration 0280-description-support.ts -> 0285-description-support.ts;
update video support maxlength text
this.USER_DESCRIPTION = {
VALIDATORS: [
Validators.minLength(3),
- Validators.maxLength(250)
+ Validators.maxLength(1000)
],
MESSAGES: {
'minlength': this.i18n('Description must be at least 3 characters long.'),
- 'maxlength': this.i18n('Description cannot be more than 250 characters long.')
+ 'maxlength': this.i18n('Description cannot be more than 1000 characters long.')
}
}
this.VIDEO_CHANNEL_DESCRIPTION = {
VALIDATORS: [
Validators.minLength(3),
- Validators.maxLength(500)
+ Validators.maxLength(1000)
],
MESSAGES: {
'minlength': i18n('Description must be at least 3 characters long.'),
- 'maxlength': i18n('Description cannot be more than 500 characters long.')
+ 'maxlength': i18n('Description cannot be more than 1000 characters long.')
}
}
this.VIDEO_CHANNEL_SUPPORT = {
VALIDATORS: [
Validators.minLength(3),
- Validators.maxLength(500)
+ Validators.maxLength(1000)
],
MESSAGES: {
'minlength': i18n('Support text must be at least 3 characters long.'),
- 'maxlength': i18n('Support text cannot be more than 500 characters long.')
+ 'maxlength': i18n('Support text cannot be more than 1000 characters long.')
}
}
}
}
this.VIDEO_SUPPORT = {
- VALIDATORS: [ Validators.minLength(3), Validators.maxLength(500) ],
+ VALIDATORS: [ Validators.minLength(3), Validators.maxLength(1000) ],
MESSAGES: {
'minlength': this.i18n('Video support must be at least 3 characters long.'),
- 'maxlength': this.i18n('Video support cannot be more than 500 characters long.')
+ 'maxlength': this.i18n('Video support cannot be more than 1000 characters long.')
}
}
// ---------------------------------------------------------------------------
-const LAST_MIGRATION_VERSION = 280
+const LAST_MIGRATION_VERSION = 285
// ---------------------------------------------------------------------------
const CONSTRAINTS_FIELDS = {
USERS: {
NAME: { min: 3, max: 120 }, // Length
- DESCRIPTION: { min: 3, max: 250 }, // Length
+ DESCRIPTION: { min: 3, max: 1000 }, // Length
USERNAME: { min: 3, max: 20 }, // Length
PASSWORD: { min: 6, max: 255 }, // Length
VIDEO_QUOTA: { min: -1 },
},
VIDEO_CHANNELS: {
NAME: { min: 3, max: 120 }, // Length
- DESCRIPTION: { min: 3, max: 500 }, // Length
- SUPPORT: { min: 3, max: 500 }, // Length
+ DESCRIPTION: { min: 3, max: 1000 }, // Length
+ SUPPORT: { min: 3, max: 1000 }, // Length
URL: { min: 3, max: 2000 } // Length
},
VIDEO_CAPTIONS: {
LANGUAGE: { min: 1, max: 10 }, // Length
TRUNCATED_DESCRIPTION: { min: 3, max: 250 }, // Length
DESCRIPTION: { min: 3, max: 10000 }, // Length
- SUPPORT: { min: 3, max: 500 }, // Length
+ SUPPORT: { min: 3, max: 1000 }, // Length
IMAGE: {
EXTNAME: [ '.jpg', '.jpeg' ],
FILE_SIZE: {
import * as Sequelize from 'sequelize'
-import { CONSTRAINTS_FIELDS } from '../constants'
async function up (utils: {
transaction: Sequelize.Transaction,
{
const data = {
- type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.max),
+ type: Sequelize.STRING(10000),
allowNull: true,
defaultValue: null
}
import * as Sequelize from 'sequelize'
-import { CONSTRAINTS_FIELDS } from '../index'
async function up (utils: {
transaction: Sequelize.Transaction,
}): Promise<void> {
{
const data = {
- type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEOS.SUPPORT.max),
+ type: Sequelize.STRING(500),
allowNull: true,
defaultValue: null
}
{
const data = {
- type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNELS.SUPPORT.max),
+ type: Sequelize.STRING(500),
allowNull: true,
defaultValue: null
}
{
const data = {
- type: Sequelize.STRING(CONSTRAINTS_FIELDS.USERS.DESCRIPTION.max),
+ type: Sequelize.STRING(250),
allowNull: true,
defaultValue: null
}
{
const data = {
- type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.max),
+ type: Sequelize.STRING(10000),
allowNull: true,
defaultValue: null
}
import * as Sequelize from 'sequelize'
-import { CONSTRAINTS_FIELDS } from '../constants'
async function up (utils: {
transaction: Sequelize.Transaction
{
const data = {
- type: Sequelize.STRING(CONSTRAINTS_FIELDS.USERS.BLOCKED_REASON.max),
+ type: Sequelize.STRING(250),
allowNull: true,
defaultValue: null
}
import * as Sequelize from 'sequelize'
-import { CONSTRAINTS_FIELDS } from '../constants'
import { VideoAbuseState } from '../../../shared/models/videos'
async function up (utils: {
{
const data = {
- type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEO_ABUSES.MODERATION_COMMENT.max),
+ type: Sequelize.STRING(300),
allowNull: true,
defaultValue: null
}
import * as Sequelize from 'sequelize'
-import { CONSTRAINTS_FIELDS } from '../constants'
import { VideoAbuseState } from '../../../shared/models/videos'
async function up (utils: {
{
const data = {
- type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEO_BLACKLIST.REASON.max),
+ type: Sequelize.STRING(300),
allowNull: true,
defaultValue: null
}
import * as Sequelize from 'sequelize'
-import { CONSTRAINTS_FIELDS } from '../constants'
async function up (utils: {
transaction: Sequelize.Transaction
--- /dev/null
+import * as Sequelize from 'sequelize'
+
+async function up (utils: {
+ transaction: Sequelize.Transaction,
+ queryInterface: Sequelize.QueryInterface,
+ sequelize: Sequelize.Sequelize,
+ db: any
+}): Promise<void> {
+ {
+ const data = {
+ type: Sequelize.STRING(1000),
+ allowNull: true,
+ defaultValue: null
+ }
+ await utils.queryInterface.changeColumn('video', 'support', data)
+ }
+
+ {
+ const data = {
+ type: Sequelize.STRING(1000),
+ allowNull: true,
+ defaultValue: null
+ }
+ await utils.queryInterface.changeColumn('videoChannel', 'support', data)
+ }
+
+ {
+ const data = {
+ type: Sequelize.STRING(1000),
+ allowNull: true,
+ defaultValue: null
+ }
+ await utils.queryInterface.changeColumn('videoChannel', 'description', data)
+ }
+
+ {
+ const data = {
+ type: Sequelize.STRING(1000),
+ allowNull: true,
+ defaultValue: null
+ }
+ await utils.queryInterface.changeColumn('account', 'description', data)
+ }
+}
+
+function down (options) {
+ throw new Error('Not implemented.')
+}
+
+export {
+ up,
+ down
+}
it('Should fail with a too long description', async function () {
const fields = {
- description: 'super'.repeat(60)
+ description: 'super'.repeat(201)
}
await makePutBodyRequest({ url: server.url, path: path + 'me', token: userAccessToken, fields })
})
it('Should fail with a long description', async function () {
- const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(150) })
+ const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(201) })
await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields })
})
it('Should fail with a long support text', async function () {
- const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(150) })
+ const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(201) })
await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields })
})
})
it('Should fail with a long description', async function () {
- const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(150) })
+ const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(201) })
await makePutBodyRequest({ url: server.url, path, token: server.accessToken, fields })
})
it('Should fail with a long support text', async function () {
- const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(150) })
+ const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(201) })
await makePutBodyRequest({ url: server.url, path, token: server.accessToken, fields })
})
})
it('Should fail with a long support text', async function () {
- const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(150) })
+ const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(201) })
await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
})
})
it('Should fail with a long support text', async function () {
- const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(150) })
+ const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(201) })
const attaches = baseCorrectAttaches
await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
})
it('Should fail with a long support text', async function () {
- const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(150) })
+ const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(201) })
await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })
})