From: Chocobozzz Date: Thu, 26 Oct 2017 13:52:11 +0000 (+0200) Subject: Increase video attributes length X-Git-Tag: v0.0.1-alpha~257 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a265f7f30fe5f25e742c99c6d43e79dfd46bf2a9;p=oweals%2Fpeertube.git Increase video attributes length Number of tags: 3 -> 5 Tag length: 10 -> 30 Video name: 50 -> 120 Video channel name: 50 -> 120 --- diff --git a/client/src/app/shared/forms/form-validators/video.ts b/client/src/app/shared/forms/form-validators/video.ts index 213ab15db..286a11179 100644 --- a/client/src/app/shared/forms/form-validators/video.ts +++ b/client/src/app/shared/forms/form-validators/video.ts @@ -1,11 +1,11 @@ import { Validators } from '@angular/forms' export const VIDEO_NAME = { - VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(50) ], + VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(120) ], MESSAGES: { 'required': 'Video name is required.', 'minlength': 'Video name must be at least 3 characters long.', - 'maxlength': 'Video name cannot be more than 50 characters long.' + 'maxlength': 'Video name cannot be more than 120 characters long.' } } @@ -45,10 +45,10 @@ export const VIDEO_DESCRIPTION = { } export const VIDEO_TAGS = { - VALIDATORS: [ Validators.minLength(2), Validators.maxLength(10) ], + VALIDATORS: [ Validators.minLength(2), Validators.maxLength(30) ], MESSAGES: { 'minlength': 'A tag should be more than 2 characters long.', - 'maxlength': 'A tag should be less than 10 characters long.' + 'maxlength': 'A tag should be less than 30 characters long.' } } diff --git a/client/src/app/videos/+video-edit/video-add.component.html b/client/src/app/videos/+video-edit/video-add.component.html index 7946c0879..136c82a7c 100644 --- a/client/src/app/videos/+video-edit/video-add.component.html +++ b/client/src/app/videos/+video-edit/video-add.component.html @@ -77,7 +77,7 @@ (press enter to add the tag) diff --git a/client/src/app/videos/+video-edit/video-update.component.html b/client/src/app/videos/+video-edit/video-update.component.html index 7f4faf21b..4ade5a671 100644 --- a/client/src/app/videos/+video-edit/video-update.component.html +++ b/client/src/app/videos/+video-edit/video-update.component.html @@ -65,7 +65,7 @@ (press enter to add the tag) diff --git a/client/src/app/videos/+video-edit/video-update.component.ts b/client/src/app/videos/+video-edit/video-update.component.ts index 30390ac05..c4ae22896 100644 --- a/client/src/app/videos/+video-edit/video-update.component.ts +++ b/client/src/app/videos/+video-edit/video-update.component.ts @@ -131,3 +131,4 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { this.form.patchValue(this.video.toJSON()) } } + diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 71012f3a3..1581a3195 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -118,17 +118,17 @@ const CONSTRAINTS_FIELDS = { REASON: { min: 2, max: 300 } // Length }, VIDEO_CHANNELS: { - NAME: { min: 3, max: 50 }, // Length + NAME: { min: 3, max: 120 }, // Length DESCRIPTION: { min: 3, max: 250 } // Length }, VIDEOS: { - NAME: { min: 3, max: 50 }, // Length + NAME: { min: 3, max: 120 }, // Length DESCRIPTION: { min: 3, max: 250 }, // Length EXTNAME: [ '.mp4', '.ogv', '.webm' ], INFO_HASH: { min: 40, max: 40 }, // Length, info hash is 20 bytes length but we represent it in hexadecimal so 20 * 2 DURATION: { min: 1, max: 7200 }, // Number - TAGS: { min: 0, max: 3 }, // Number of total tags - TAG: { min: 2, max: 10 }, // Length + TAGS: { min: 0, max: 5 }, // Number of total tags + TAG: { min: 2, max: 30 }, // Length THUMBNAIL: { min: 2, max: 30 }, THUMBNAIL_DATA: { min: 0, max: 20000 }, // Bytes VIEWS: { min: 0 }, diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts index b46b90c14..08d1af52e 100644 --- a/server/tests/api/check-params/video-channels.ts +++ b/server/tests/api/check-params/video-channels.ts @@ -119,6 +119,9 @@ describe('Test videos API validator', function () { it('Should fail with a long name', async function () { const fields = { name: 'hello tooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' + + 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' + + 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' + + 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' + 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo long', description: 'super description' } @@ -178,6 +181,9 @@ describe('Test videos API validator', function () { it('Should fail with a long name', async function () { const fields = { name: 'hello tooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' + + 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' + + 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' + + 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' + 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo long', description: 'super description' } diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts index 167b45b61..765b9c16e 100644 --- a/server/tests/api/check-params/videos.ts +++ b/server/tests/api/check-params/videos.ts @@ -124,7 +124,9 @@ describe('Test videos API validator', function () { it('Should fail with a long name', async function () { const fields = { - name: 'My very very very very very very very very very very very very very very very very long name', + name: 'My very very very very very very very very very very very very very very very very very ' + + 'very very very very very very very very very very very very very very very very long long' + + 'very very very very very very very very very very very very very very very very long name', category: 5, licence: 1, language: 6, @@ -358,7 +360,7 @@ describe('Test videos API validator', function () { language: 6, nsfw: false, description: 'my super description', - tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ], + tags: [ 'tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6' ], channelId } const attaches = { @@ -392,7 +394,7 @@ describe('Test videos API validator', function () { language: 6, nsfw: false, description: 'my super description', - tags: [ 'my_super_tag_too_long', 'tag1' ], + tags: [ 'my_super_tag_too_long_long_long_long_long_long', 'tag1' ], channelId } const attaches = { @@ -543,7 +545,9 @@ describe('Test videos API validator', function () { it('Should fail with a long name', async function () { const fields = { - name: 'My very very very very very very very very very very very very very very very very long name', + name: 'My very very very very very very very very very very very very very very very very very ' + + 'very very very very very very very very very very very very very very very very long long' + + 'very very very very very very very very very very very very very very very very long name', category: 5, licence: 2, language: 6, @@ -629,7 +633,7 @@ describe('Test videos API validator', function () { language: 6, nsfw: false, description: 'my super description', - tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ] + tags: [ 'tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6' ] } await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields }) }) @@ -655,7 +659,7 @@ describe('Test videos API validator', function () { language: 6, nsfw: false, description: 'my super description', - tags: [ 'my_super_tag_too_long', 'tag1' ] + tags: [ 'my_super_tag_too_long_long_long_long', 'tag1' ] } await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields }) })