diff options
author | Chocobozzz <me@florianbigard.com> | 2018-05-07 11:31:23 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-05-07 11:31:23 +0200 |
commit | 7d8e778ad031873b2bcc273d281baf6559610f71 (patch) | |
tree | 5548c06134a8d9f2f574022c9bcb0978b6e4d4ed | |
parent | b0ae905e7b95a218d087d669c74d86a2679174ab (diff) | |
download | PeerTube-7d8e778ad031873b2bcc273d281baf6559610f71.tar.gz PeerTube-7d8e778ad031873b2bcc273d281baf6559610f71.tar.zst PeerTube-7d8e778ad031873b2bcc273d281baf6559610f71.zip |
Fix video channel update/create on empty fields
3 files changed, 10 insertions, 11 deletions
diff --git a/client/src/app/my-account/my-account-video-channels/my-account-video-channel-create.component.ts b/client/src/app/my-account/my-account-video-channels/my-account-video-channel-create.component.ts index c3c0ae63a..0f03548ad 100644 --- a/client/src/app/my-account/my-account-video-channels/my-account-video-channel-create.component.ts +++ b/client/src/app/my-account/my-account-video-channels/my-account-video-channel-create.component.ts | |||
@@ -64,8 +64,8 @@ export class MyAccountVideoChannelCreateComponent extends MyAccountVideoChannelE | |||
64 | const body = this.form.value | 64 | const body = this.form.value |
65 | const videoChannelCreate: VideoChannelCreate = { | 65 | const videoChannelCreate: VideoChannelCreate = { |
66 | displayName: body['display-name'], | 66 | displayName: body['display-name'], |
67 | description: body.description, | 67 | description: body.description || undefined, |
68 | support: body.support | 68 | support: body.support || undefined |
69 | } | 69 | } |
70 | 70 | ||
71 | this.videoChannelService.createVideoChannel(videoChannelCreate).subscribe( | 71 | this.videoChannelService.createVideoChannel(videoChannelCreate).subscribe( |
@@ -84,6 +84,6 @@ export class MyAccountVideoChannelCreateComponent extends MyAccountVideoChannelE | |||
84 | } | 84 | } |
85 | 85 | ||
86 | getFormButtonTitle () { | 86 | getFormButtonTitle () { |
87 | return 'Create this video channel' | 87 | return 'Create' |
88 | } | 88 | } |
89 | } | 89 | } |
diff --git a/client/src/app/my-account/my-account-video-channels/my-account-video-channel-update.component.ts b/client/src/app/my-account/my-account-video-channels/my-account-video-channel-update.component.ts index 3cb8b9e9a..c0dc6a939 100644 --- a/client/src/app/my-account/my-account-video-channels/my-account-video-channel-update.component.ts +++ b/client/src/app/my-account/my-account-video-channels/my-account-video-channel-update.component.ts | |||
@@ -92,8 +92,8 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE | |||
92 | const body = this.form.value | 92 | const body = this.form.value |
93 | const videoChannelUpdate: VideoChannelUpdate = { | 93 | const videoChannelUpdate: VideoChannelUpdate = { |
94 | displayName: body['display-name'], | 94 | displayName: body['display-name'], |
95 | description: body.description, | 95 | description: body.description || undefined, |
96 | support: body.support | 96 | support: body.support || undefined |
97 | } | 97 | } |
98 | 98 | ||
99 | this.videoChannelService.updateVideoChannel(this.videoChannelToUpdate.uuid, videoChannelUpdate).subscribe( | 99 | this.videoChannelService.updateVideoChannel(this.videoChannelToUpdate.uuid, videoChannelUpdate).subscribe( |
@@ -112,8 +112,6 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE | |||
112 | } | 112 | } |
113 | 113 | ||
114 | getFormButtonTitle () { | 114 | getFormButtonTitle () { |
115 | return this.videoChannelToUpdate | 115 | return 'Update' |
116 | ? 'Update ' + this.videoChannelToUpdate.displayName + ' video channel' | ||
117 | : 'Update' | ||
118 | } | 116 | } |
119 | } | 117 | } |
diff --git a/server/middlewares/validators/video-channels.ts b/server/middlewares/validators/video-channels.ts index 3af20a1b4..92c0de419 100644 --- a/server/middlewares/validators/video-channels.ts +++ b/server/middlewares/validators/video-channels.ts | |||
@@ -4,14 +4,15 @@ import { UserRight } from '../../../shared' | |||
4 | import { isAccountIdExist } from '../../helpers/custom-validators/accounts' | 4 | import { isAccountIdExist } from '../../helpers/custom-validators/accounts' |
5 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' | 5 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' |
6 | import { | 6 | import { |
7 | isVideoChannelDescriptionValid, isVideoChannelExist, | 7 | isVideoChannelDescriptionValid, |
8 | isVideoChannelNameValid, isVideoChannelSupportValid | 8 | isVideoChannelExist, |
9 | isVideoChannelNameValid, | ||
10 | isVideoChannelSupportValid | ||
9 | } from '../../helpers/custom-validators/video-channels' | 11 | } from '../../helpers/custom-validators/video-channels' |
10 | import { logger } from '../../helpers/logger' | 12 | import { logger } from '../../helpers/logger' |
11 | import { UserModel } from '../../models/account/user' | 13 | import { UserModel } from '../../models/account/user' |
12 | import { VideoChannelModel } from '../../models/video/video-channel' | 14 | import { VideoChannelModel } from '../../models/video/video-channel' |
13 | import { areValidationErrors } from './utils' | 15 | import { areValidationErrors } from './utils' |
14 | import { AccountModel } from '../../models/account/account' | ||
15 | 16 | ||
16 | const listVideoAccountChannelsValidator = [ | 17 | const listVideoAccountChannelsValidator = [ |
17 | param('accountId').custom(isIdOrUUIDValid).withMessage('Should have a valid account id'), | 18 | param('accountId').custom(isIdOrUUIDValid).withMessage('Should have a valid account id'), |