aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/accounts.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-02-21 16:44:18 +0100
committerChocobozzz <me@florianbigard.com>2018-02-21 16:44:43 +0100
commite8cb44090e654fda339506dccfcec7fea8722723 (patch)
tree2a36d264cf44cededff0e272919316a3feabcbc1 /server/helpers/custom-validators/accounts.ts
parent276d03ed1a469fd4e3579f92392b6f9a1567d1ca (diff)
downloadPeerTube-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.ts11
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
34function 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
34async function isAccountExist (p: Bluebird<AccountModel>, res: Response) { 44async 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}