aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/shared/forms/form-validators/video-channel.ts8
-rw-r--r--client/src/app/shared/forms/form-validators/video.ts4
-rw-r--r--server/initializers/constants.ts8
-rw-r--r--server/initializers/migrations/0215-video-support-length.ts44
-rw-r--r--server/models/video/video-channel.ts7
5 files changed, 58 insertions, 13 deletions
diff --git a/client/src/app/shared/forms/form-validators/video-channel.ts b/client/src/app/shared/forms/form-validators/video-channel.ts
index 6233d17f7..2185cdaa9 100644
--- a/client/src/app/shared/forms/form-validators/video-channel.ts
+++ b/client/src/app/shared/forms/form-validators/video-channel.ts
@@ -15,20 +15,20 @@ export const VIDEO_CHANNEL_DISPLAY_NAME = {
15export const VIDEO_CHANNEL_DESCRIPTION = { 15export const VIDEO_CHANNEL_DESCRIPTION = {
16 VALIDATORS: [ 16 VALIDATORS: [
17 Validators.minLength(3), 17 Validators.minLength(3),
18 Validators.maxLength(250) 18 Validators.maxLength(500)
19 ], 19 ],
20 MESSAGES: { 20 MESSAGES: {
21 'minlength': 'Description must be at least 3 characters long.', 21 'minlength': 'Description must be at least 3 characters long.',
22 'maxlength': 'Description cannot be more than 250 characters long.' 22 'maxlength': 'Description cannot be more than 500 characters long.'
23 } 23 }
24} 24}
25export const VIDEO_CHANNEL_SUPPORT = { 25export const VIDEO_CHANNEL_SUPPORT = {
26 VALIDATORS: [ 26 VALIDATORS: [
27 Validators.minLength(3), 27 Validators.minLength(3),
28 Validators.maxLength(300) 28 Validators.maxLength(500)
29 ], 29 ],
30 MESSAGES: { 30 MESSAGES: {
31 'minlength': 'Support text must be at least 3 characters long.', 31 'minlength': 'Support text must be at least 3 characters long.',
32 'maxlength': 'Support text cannot be more than 300 characters long.' 32 'maxlength': 'Support text cannot be more than 500 characters long.'
33 } 33 }
34} 34}
diff --git a/client/src/app/shared/forms/form-validators/video.ts b/client/src/app/shared/forms/form-validators/video.ts
index 9ecbbbd60..a986243df 100644
--- a/client/src/app/shared/forms/form-validators/video.ts
+++ b/client/src/app/shared/forms/form-validators/video.ts
@@ -60,9 +60,9 @@ export const VIDEO_TAGS = {
60} 60}
61 61
62export const VIDEO_SUPPORT = { 62export const VIDEO_SUPPORT = {
63 VALIDATORS: [ Validators.minLength(3), Validators.maxLength(300) ], 63 VALIDATORS: [ Validators.minLength(3), Validators.maxLength(500) ],
64 MESSAGES: { 64 MESSAGES: {
65 'minlength': 'Video support must be at least 3 characters long.', 65 'minlength': 'Video support must be at least 3 characters long.',
66 'maxlength': 'Video support cannot be more than 300 characters long.' 66 'maxlength': 'Video support cannot be more than 500 characters long.'
67 } 67 }
68} 68}
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 6556aa168..c52c27c78 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -13,7 +13,7 @@ let config: IConfig = require('config')
13 13
14// --------------------------------------------------------------------------- 14// ---------------------------------------------------------------------------
15 15
16const LAST_MIGRATION_VERSION = 210 16const LAST_MIGRATION_VERSION = 215
17 17
18// --------------------------------------------------------------------------- 18// ---------------------------------------------------------------------------
19 19
@@ -192,8 +192,8 @@ const CONSTRAINTS_FIELDS = {
192 }, 192 },
193 VIDEO_CHANNELS: { 193 VIDEO_CHANNELS: {
194 NAME: { min: 3, max: 120 }, // Length 194 NAME: { min: 3, max: 120 }, // Length
195 DESCRIPTION: { min: 3, max: 250 }, // Length 195 DESCRIPTION: { min: 3, max: 500 }, // Length
196 SUPPORT: { min: 3, max: 300 }, // Length 196 SUPPORT: { min: 3, max: 500 }, // Length
197 URL: { min: 3, max: 2000 } // Length 197 URL: { min: 3, max: 2000 } // Length
198 }, 198 },
199 VIDEOS: { 199 VIDEOS: {
@@ -201,7 +201,7 @@ const CONSTRAINTS_FIELDS = {
201 LANGUAGE: { min: 1, max: 10 }, // Length 201 LANGUAGE: { min: 1, max: 10 }, // Length
202 TRUNCATED_DESCRIPTION: { min: 3, max: 250 }, // Length 202 TRUNCATED_DESCRIPTION: { min: 3, max: 250 }, // Length
203 DESCRIPTION: { min: 3, max: 10000 }, // Length 203 DESCRIPTION: { min: 3, max: 10000 }, // Length
204 SUPPORT: { min: 3, max: 300 }, // Length 204 SUPPORT: { min: 3, max: 500 }, // Length
205 IMAGE: { 205 IMAGE: {
206 EXTNAME: [ '.jpg', '.jpeg' ], 206 EXTNAME: [ '.jpg', '.jpeg' ],
207 FILE_SIZE: { 207 FILE_SIZE: {
diff --git a/server/initializers/migrations/0215-video-support-length.ts b/server/initializers/migrations/0215-video-support-length.ts
new file mode 100644
index 000000000..994eda60d
--- /dev/null
+++ b/server/initializers/migrations/0215-video-support-length.ts
@@ -0,0 +1,44 @@
1import * as Sequelize from 'sequelize'
2import { CONSTRAINTS_FIELDS } from '../index'
3
4async function up (utils: {
5 transaction: Sequelize.Transaction,
6 queryInterface: Sequelize.QueryInterface,
7 sequelize: Sequelize.Sequelize
8}): Promise<void> {
9 {
10 const data = {
11 type: Sequelize.STRING(500),
12 allowNull: true,
13 defaultValue: null
14 }
15 await utils.queryInterface.changeColumn('video', 'support', data)
16 }
17
18 {
19 const data = {
20 type: Sequelize.STRING(500),
21 allowNull: true,
22 defaultValue: null
23 }
24 await utils.queryInterface.changeColumn('videoChannel', 'support', data)
25 }
26
27 {
28 const data = {
29 type: Sequelize.STRING(500),
30 allowNull: true,
31 defaultValue: null
32 }
33 await utils.queryInterface.changeColumn('videoChannel', 'description', data)
34 }
35}
36
37function down (options) {
38 throw new Error('Not implemented.')
39}
40
41export {
42 up,
43 down
44}
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts
index 4a50af265..8498143fe 100644
--- a/server/models/video/video-channel.ts
+++ b/server/models/video/video-channel.ts
@@ -1,6 +1,6 @@
1import { 1import {
2 AllowNull, BeforeDestroy, BelongsTo, Column, CreatedAt, DefaultScope, ForeignKey, HasMany, Is, Model, Scopes, Table, 2 AllowNull, BeforeDestroy, BelongsTo, Column, CreatedAt, DefaultScope, ForeignKey, HasMany, Is, Model, Scopes, Table,
3 UpdatedAt, Default 3 UpdatedAt, Default, DataType
4} from 'sequelize-typescript' 4} from 'sequelize-typescript'
5import { ActivityPubActor } from '../../../shared/models/activitypub' 5import { ActivityPubActor } from '../../../shared/models/activitypub'
6import { VideoChannel } from '../../../shared/models/videos' 6import { VideoChannel } from '../../../shared/models/videos'
@@ -14,6 +14,7 @@ import { AccountModel } from '../account/account'
14import { ActorModel } from '../activitypub/actor' 14import { ActorModel } from '../activitypub/actor'
15import { getSort, throwIfNotValid } from '../utils' 15import { getSort, throwIfNotValid } from '../utils'
16import { VideoModel } from './video' 16import { VideoModel } from './video'
17import { CONSTRAINTS_FIELDS } from '../../initializers'
17 18
18enum ScopeNames { 19enum ScopeNames {
19 WITH_ACCOUNT = 'WITH_ACCOUNT', 20 WITH_ACCOUNT = 'WITH_ACCOUNT',
@@ -73,13 +74,13 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
73 @AllowNull(true) 74 @AllowNull(true)
74 @Default(null) 75 @Default(null)
75 @Is('VideoChannelDescription', value => throwIfNotValid(value, isVideoChannelDescriptionValid, 'description')) 76 @Is('VideoChannelDescription', value => throwIfNotValid(value, isVideoChannelDescriptionValid, 'description'))
76 @Column 77 @Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNELS.DESCRIPTION.max))
77 description: string 78 description: string
78 79
79 @AllowNull(true) 80 @AllowNull(true)
80 @Default(null) 81 @Default(null)
81 @Is('VideoChannelSupport', value => throwIfNotValid(value, isVideoChannelSupportValid, 'support')) 82 @Is('VideoChannelSupport', value => throwIfNotValid(value, isVideoChannelSupportValid, 'support'))
82 @Column 83 @Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNELS.SUPPORT.max))
83 support: string 84 support: string
84 85
85 @CreatedAt 86 @CreatedAt