diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-21 16:44:18 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-21 16:44:43 +0100 |
commit | e8cb44090e654fda339506dccfcec7fea8722723 (patch) | |
tree | 2a36d264cf44cededff0e272919316a3feabcbc1 /server/helpers/custom-validators/accounts.ts | |
parent | 276d03ed1a469fd4e3579f92392b6f9a1567d1ca (diff) | |
download | PeerTube-e8cb44090e654fda339506dccfcec7fea8722723.tar.gz PeerTube-e8cb44090e654fda339506dccfcec7fea8722723.tar.zst PeerTube-e8cb44090e654fda339506dccfcec7fea8722723.zip |
Add links to comment mentions
Diffstat (limited to 'server/helpers/custom-validators/accounts.ts')
-rw-r--r-- | server/helpers/custom-validators/accounts.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/server/helpers/custom-validators/accounts.ts b/server/helpers/custom-validators/accounts.ts index a46ffc162..cc8641d6b 100644 --- a/server/helpers/custom-validators/accounts.ts +++ b/server/helpers/custom-validators/accounts.ts | |||
@@ -31,6 +31,16 @@ function isLocalAccountNameExist (name: string, res: Response) { | |||
31 | return isAccountExist(promise, res) | 31 | return isAccountExist(promise, res) |
32 | } | 32 | } |
33 | 33 | ||
34 | function isAccountNameWithHostExist (nameWithDomain: string, res: Response) { | ||
35 | const [ accountName, host ] = nameWithDomain.split('@') | ||
36 | |||
37 | let promise: Bluebird<AccountModel> | ||
38 | if (!host) promise = AccountModel.loadLocalByName(accountName) | ||
39 | else promise = AccountModel.loadLocalByNameAndHost(accountName, host) | ||
40 | |||
41 | return isAccountExist(promise, res) | ||
42 | } | ||
43 | |||
34 | async function isAccountExist (p: Bluebird<AccountModel>, res: Response) { | 44 | async function isAccountExist (p: Bluebird<AccountModel>, res: Response) { |
35 | const account = await p | 45 | const account = await p |
36 | 46 | ||
@@ -53,5 +63,6 @@ export { | |||
53 | isAccountIdExist, | 63 | isAccountIdExist, |
54 | isLocalAccountNameExist, | 64 | isLocalAccountNameExist, |
55 | isAccountDescriptionValid, | 65 | isAccountDescriptionValid, |
66 | isAccountNameWithHostExist, | ||
56 | isAccountNameValid | 67 | isAccountNameValid |
57 | } | 68 | } |