diff options
Diffstat (limited to 'server/helpers/custom-validators/accounts.ts')
-rw-r--r-- | server/helpers/custom-validators/accounts.ts | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/server/helpers/custom-validators/accounts.ts b/server/helpers/custom-validators/accounts.ts index 191de1496..aad04fe93 100644 --- a/server/helpers/custom-validators/accounts.ts +++ b/server/helpers/custom-validators/accounts.ts | |||
@@ -38,13 +38,7 @@ function isLocalAccountNameExist (name: string, res: Response, sendNotFound = tr | |||
38 | } | 38 | } |
39 | 39 | ||
40 | function isAccountNameWithHostExist (nameWithDomain: string, res: Response, sendNotFound = true) { | 40 | function isAccountNameWithHostExist (nameWithDomain: string, res: Response, sendNotFound = true) { |
41 | const [ accountName, host ] = nameWithDomain.split('@') | 41 | return isAccountExist(AccountModel.loadByNameWithHost(nameWithDomain), res, sendNotFound) |
42 | |||
43 | let promise: Bluebird<AccountModel> | ||
44 | if (!host || host === CONFIG.WEBSERVER.HOST) promise = AccountModel.loadLocalByName(accountName) | ||
45 | else promise = AccountModel.loadByNameAndHost(accountName, host) | ||
46 | |||
47 | return isAccountExist(promise, res, sendNotFound) | ||
48 | } | 42 | } |
49 | 43 | ||
50 | async function isAccountExist (p: Bluebird<AccountModel>, res: Response, sendNotFound: boolean) { | 44 | async function isAccountExist (p: Bluebird<AccountModel>, res: Response, sendNotFound: boolean) { |