From e8cb44090e654fda339506dccfcec7fea8722723 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 21 Feb 2018 16:44:18 +0100 Subject: Add links to comment mentions --- server/helpers/custom-validators/accounts.ts | 11 +++++++++++ server/helpers/logger.ts | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'server/helpers') 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) { return isAccountExist(promise, res) } +function isAccountNameWithHostExist (nameWithDomain: string, res: Response) { + const [ accountName, host ] = nameWithDomain.split('@') + + let promise: Bluebird + if (!host) promise = AccountModel.loadLocalByName(accountName) + else promise = AccountModel.loadLocalByNameAndHost(accountName, host) + + return isAccountExist(promise, res) +} + async function isAccountExist (p: Bluebird, res: Response) { const account = await p @@ -53,5 +63,6 @@ export { isAccountIdExist, isLocalAccountNameExist, isAccountDescriptionValid, + isAccountNameWithHostExist, isAccountNameValid } diff --git a/server/helpers/logger.ts b/server/helpers/logger.ts index 7d1d72f29..a4e5b58a4 100644 --- a/server/helpers/logger.ts +++ b/server/helpers/logger.ts @@ -59,7 +59,7 @@ const logger = new winston.createLogger({ ) }), new winston.transports.Console({ - handleExcegiptions: true, + handleExceptions: true, humanReadableUnhandledException: true, format: winston.format.combine( timestampFormatter, -- cgit v1.2.3