mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2026-10-13 17:01:59 -05:00
Fix backend channel name validator consistency
This commit is contained in:
5 files changed
+29
-22
No files matched your search
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user