X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fcustom-validators%2Fvideo-channels.ts;h=5787c3850cbace61a59be7f62d011ee5cbc1592a;hb=975e6e0e44e2f2b25f804cd48a62e2a8d9e8117a;hp=b6be557e622d1915fa02f546f1108af48d769ee1;hpb=72c7248b6fdcdb2175e726ff51b42e7555f2bd84;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/custom-validators/video-channels.ts b/server/helpers/custom-validators/video-channels.ts index b6be557e6..5787c3850 100644 --- a/server/helpers/custom-validators/video-channels.ts +++ b/server/helpers/custom-validators/video-channels.ts @@ -8,9 +8,14 @@ import { database as db, CONSTRAINTS_FIELDS } from '../../initializers' import { VideoChannelInstance } from '../../models' import { logger } from '../logger' import { exists } from './misc' +import { isActivityPubUrlValid } from './index' const VIDEO_CHANNELS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_CHANNELS +function isVideoChannelUrlValid (value: string) { + return isActivityPubUrlValid(value) +} + function isVideoChannelDescriptionValid (value: string) { return value === null || validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.DESCRIPTION) } @@ -26,9 +31,9 @@ function isVideoChannelUUIDValid (value: string) { function checkVideoChannelExists (id: string, res: express.Response, callback: () => void) { let promise: Promise if (validator.isInt(id)) { - promise = db.VideoChannel.loadAndPopulateAuthor(+id) + promise = db.VideoChannel.loadAndPopulateAccount(+id) } else { // UUID - promise = db.VideoChannel.loadByUUIDAndPopulateAuthor(id) + promise = db.VideoChannel.loadByUUIDAndPopulateAccount(id) } promise.then(videoChannel => { @@ -53,5 +58,6 @@ export { isVideoChannelDescriptionValid, isVideoChannelNameValid, isVideoChannelUUIDValid, - checkVideoChannelExists + checkVideoChannelExists, + isVideoChannelUrlValid }