Fix video channel update/create on empty fields
This commit is contained in:
parent
b0ae905e7b
commit
7d8e778ad0
3 changed files with 10 additions and 11 deletions
|
@ -64,8 +64,8 @@ export class MyAccountVideoChannelCreateComponent extends MyAccountVideoChannelE
|
||||||
const body = this.form.value
|
const body = this.form.value
|
||||||
const videoChannelCreate: VideoChannelCreate = {
|
const videoChannelCreate: VideoChannelCreate = {
|
||||||
displayName: body['display-name'],
|
displayName: body['display-name'],
|
||||||
description: body.description,
|
description: body.description || undefined,
|
||||||
support: body.support
|
support: body.support || undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
this.videoChannelService.createVideoChannel(videoChannelCreate).subscribe(
|
this.videoChannelService.createVideoChannel(videoChannelCreate).subscribe(
|
||||||
|
@ -84,6 +84,6 @@ export class MyAccountVideoChannelCreateComponent extends MyAccountVideoChannelE
|
||||||
}
|
}
|
||||||
|
|
||||||
getFormButtonTitle () {
|
getFormButtonTitle () {
|
||||||
return 'Create this video channel'
|
return 'Create'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,8 +92,8 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE
|
||||||
const body = this.form.value
|
const body = this.form.value
|
||||||
const videoChannelUpdate: VideoChannelUpdate = {
|
const videoChannelUpdate: VideoChannelUpdate = {
|
||||||
displayName: body['display-name'],
|
displayName: body['display-name'],
|
||||||
description: body.description,
|
description: body.description || undefined,
|
||||||
support: body.support
|
support: body.support || undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
this.videoChannelService.updateVideoChannel(this.videoChannelToUpdate.uuid, videoChannelUpdate).subscribe(
|
this.videoChannelService.updateVideoChannel(this.videoChannelToUpdate.uuid, videoChannelUpdate).subscribe(
|
||||||
|
@ -112,8 +112,6 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE
|
||||||
}
|
}
|
||||||
|
|
||||||
getFormButtonTitle () {
|
getFormButtonTitle () {
|
||||||
return this.videoChannelToUpdate
|
return 'Update'
|
||||||
? 'Update ' + this.videoChannelToUpdate.displayName + ' video channel'
|
|
||||||
: 'Update'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,14 +4,15 @@ import { UserRight } from '../../../shared'
|
||||||
import { isAccountIdExist } from '../../helpers/custom-validators/accounts'
|
import { isAccountIdExist } from '../../helpers/custom-validators/accounts'
|
||||||
import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc'
|
import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc'
|
||||||
import {
|
import {
|
||||||
isVideoChannelDescriptionValid, isVideoChannelExist,
|
isVideoChannelDescriptionValid,
|
||||||
isVideoChannelNameValid, isVideoChannelSupportValid
|
isVideoChannelExist,
|
||||||
|
isVideoChannelNameValid,
|
||||||
|
isVideoChannelSupportValid
|
||||||
} from '../../helpers/custom-validators/video-channels'
|
} from '../../helpers/custom-validators/video-channels'
|
||||||
import { logger } from '../../helpers/logger'
|
import { logger } from '../../helpers/logger'
|
||||||
import { UserModel } from '../../models/account/user'
|
import { UserModel } from '../../models/account/user'
|
||||||
import { VideoChannelModel } from '../../models/video/video-channel'
|
import { VideoChannelModel } from '../../models/video/video-channel'
|
||||||
import { areValidationErrors } from './utils'
|
import { areValidationErrors } from './utils'
|
||||||
import { AccountModel } from '../../models/account/account'
|
|
||||||
|
|
||||||
const listVideoAccountChannelsValidator = [
|
const listVideoAccountChannelsValidator = [
|
||||||
param('accountId').custom(isIdOrUUIDValid).withMessage('Should have a valid account id'),
|
param('accountId').custom(isIdOrUUIDValid).withMessage('Should have a valid account id'),
|
||||||
|
|
Loading…
Reference in a new issue