diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-13 17:39:41 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:51 +0100 |
commit | 7a7724e66e4533523083e7336cd0d0c747c4a33b (patch) | |
tree | 805299eb9c6829158cd17e5a823a84a3a54d8209 /server/helpers/custom-validators/video-accounts.ts | |
parent | 571389d43b8fc8aaf27e77c06f19b320b08dbbc9 (diff) | |
download | PeerTube-7a7724e66e4533523083e7336cd0d0c747c4a33b.tar.gz PeerTube-7a7724e66e4533523083e7336cd0d0c747c4a33b.tar.zst PeerTube-7a7724e66e4533523083e7336cd0d0c747c4a33b.zip |
Handle follow/accept
Diffstat (limited to 'server/helpers/custom-validators/video-accounts.ts')
-rw-r--r-- | server/helpers/custom-validators/video-accounts.ts | 8 |
1 files changed, 8 insertions, 0 deletions
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' | |||
8 | import { logger } from '../logger' | 8 | import { logger } from '../logger' |
9 | 9 | ||
10 | import { isUserUsernameValid } from './users' | 10 | import { isUserUsernameValid } from './users' |
11 | import { isHostValid } from './pods' | ||
11 | 12 | ||
12 | function isVideoAccountNameValid (value: string) { | 13 | function isVideoAccountNameValid (value: string) { |
13 | return isUserUsernameValid(value) | 14 | return isUserUsernameValid(value) |
14 | } | 15 | } |
15 | 16 | ||
17 | function isAccountNameWithHostValid (value: string) { | ||
18 | const [ name, host ] = value.split('@') | ||
19 | |||
20 | return isVideoAccountNameValid(name) && isHostValid(host) | ||
21 | } | ||
22 | |||
16 | function checkVideoAccountExists (id: string, res: express.Response, callback: () => void) { | 23 | function checkVideoAccountExists (id: string, res: express.Response, callback: () => void) { |
17 | let promise: Promise<AccountInstance> | 24 | let promise: Promise<AccountInstance> |
18 | if (validator.isInt(id)) { | 25 | if (validator.isInt(id)) { |
@@ -41,5 +48,6 @@ function checkVideoAccountExists (id: string, res: express.Response, callback: ( | |||
41 | 48 | ||
42 | export { | 49 | export { |
43 | checkVideoAccountExists, | 50 | checkVideoAccountExists, |
51 | isAccountNameWithHostValid, | ||
44 | isVideoAccountNameValid | 52 | isVideoAccountNameValid |
45 | } | 53 | } |