mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 10:19:35 +02:00
Fix backend channel name validator consistency
This commit is contained in:
parent
352819ef92
commit
27db78400c
5 changed files with 29 additions and 22 deletions
|
@ -1,14 +1,20 @@
|
|||
import validator from 'validator'
|
||||
import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
|
||||
import { exists } from './misc'
|
||||
import { isUserUsernameValid } from './users'
|
||||
|
||||
const VIDEO_CHANNELS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_CHANNELS
|
||||
|
||||
function isVideoChannelUsernameValid (value: string) {
|
||||
// Use the same constraints than user username
|
||||
return isUserUsernameValid(value)
|
||||
}
|
||||
|
||||
function isVideoChannelDescriptionValid (value: string) {
|
||||
return value === null || validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.DESCRIPTION)
|
||||
}
|
||||
|
||||
function isVideoChannelNameValid (value: string) {
|
||||
function isVideoChannelDisplayNameValid (value: string) {
|
||||
return exists(value) && validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.NAME)
|
||||
}
|
||||
|
||||
|
@ -19,7 +25,8 @@ function isVideoChannelSupportValid (value: string) {
|
|||
// ---------------------------------------------------------------------------
|
||||
|
||||
export {
|
||||
isVideoChannelUsernameValid,
|
||||
isVideoChannelDescriptionValid,
|
||||
isVideoChannelNameValid,
|
||||
isVideoChannelDisplayNameValid,
|
||||
isVideoChannelSupportValid
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue