From 7a7724e66e4533523083e7336cd0d0c747c4a33b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 13 Nov 2017 17:39:41 +0100 Subject: Handle follow/accept --- server/helpers/custom-validators/video-accounts.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'server/helpers/custom-validators') diff --git a/server/helpers/custom-validators/video-accounts.ts b/server/helpers/custom-validators/video-accounts.ts index 3f3e9edd1..31808ae1e 100644 --- a/server/helpers/custom-validators/video-accounts.ts +++ b/server/helpers/custom-validators/video-accounts.ts @@ -8,11 +8,18 @@ import { AccountInstance } from '../../models' import { logger } from '../logger' import { isUserUsernameValid } from './users' +import { isHostValid } from './pods' function isVideoAccountNameValid (value: string) { return isUserUsernameValid(value) } +function isAccountNameWithHostValid (value: string) { + const [ name, host ] = value.split('@') + + return isVideoAccountNameValid(name) && isHostValid(host) +} + function checkVideoAccountExists (id: string, res: express.Response, callback: () => void) { let promise: Promise if (validator.isInt(id)) { @@ -41,5 +48,6 @@ function checkVideoAccountExists (id: string, res: express.Response, callback: ( export { checkVideoAccountExists, + isAccountNameWithHostValid, isVideoAccountNameValid } -- cgit v1.2.3