]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix video channel update/create on empty fields
authorChocobozzz <me@florianbigard.com>
Mon, 7 May 2018 09:31:23 +0000 (11:31 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 7 May 2018 09:31:23 +0000 (11:31 +0200)
client/src/app/my-account/my-account-video-channels/my-account-video-channel-create.component.ts
client/src/app/my-account/my-account-video-channels/my-account-video-channel-update.component.ts
server/middlewares/validators/video-channels.ts

index c3c0ae63a0961546cc1c41e9b99e8716a63a3506..0f03548ade8c7a075af7b0e719f4619aacbad859 100644 (file)
@@ -64,8 +64,8 @@ export class MyAccountVideoChannelCreateComponent extends MyAccountVideoChannelE
     const body = this.form.value
     const videoChannelCreate: VideoChannelCreate = {
       displayName: body['display-name'],
-      description: body.description,
-      support: body.support
+      description: body.description || undefined,
+      support: body.support || undefined
     }
 
     this.videoChannelService.createVideoChannel(videoChannelCreate).subscribe(
@@ -84,6 +84,6 @@ export class MyAccountVideoChannelCreateComponent extends MyAccountVideoChannelE
   }
 
   getFormButtonTitle () {
-    return 'Create this video channel'
+    return 'Create'
   }
 }
index 3cb8b9e9a7d5bd81b6880ac53d1fa1aeffa7bdd9..c0dc6a9391ed4e59bad57ca13cf7da7b4237b6b4 100644 (file)
@@ -92,8 +92,8 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE
     const body = this.form.value
     const videoChannelUpdate: VideoChannelUpdate = {
       displayName: body['display-name'],
-      description: body.description,
-      support: body.support
+      description: body.description || undefined,
+      support: body.support || undefined
     }
 
     this.videoChannelService.updateVideoChannel(this.videoChannelToUpdate.uuid, videoChannelUpdate).subscribe(
@@ -112,8 +112,6 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE
   }
 
   getFormButtonTitle () {
-    return this.videoChannelToUpdate
-      ? 'Update ' + this.videoChannelToUpdate.displayName + ' video channel'
-      : 'Update'
+    return 'Update'
   }
 }
index 3af20a1b4d7571ee2af0e2fc91e2d65985dd2edc..92c0de419eec0256a5862a22c4ada653543080ac 100644 (file)
@@ -4,14 +4,15 @@ import { UserRight } from '../../../shared'
 import { isAccountIdExist } from '../../helpers/custom-validators/accounts'
 import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc'
 import {
-  isVideoChannelDescriptionValid, isVideoChannelExist,
-  isVideoChannelNameValid, isVideoChannelSupportValid
+  isVideoChannelDescriptionValid,
+  isVideoChannelExist,
+  isVideoChannelNameValid,
+  isVideoChannelSupportValid
 } from '../../helpers/custom-validators/video-channels'
 import { logger } from '../../helpers/logger'
 import { UserModel } from '../../models/account/user'
 import { VideoChannelModel } from '../../models/video/video-channel'
 import { areValidationErrors } from './utils'
-import { AccountModel } from '../../models/account/account'
 
 const listVideoAccountChannelsValidator = [
   param('accountId').custom(isIdOrUUIDValid).withMessage('Should have a valid account id'),