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 | |
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')
-rw-r--r-- | server/helpers/custom-validators/accounts.ts | 11 | ||||
-rw-r--r-- | server/helpers/logger.ts | 2 |
2 files changed, 12 insertions, 1 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 | } |
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({ | |||
59 | ) | 59 | ) |
60 | }), | 60 | }), |
61 | new winston.transports.Console({ | 61 | new winston.transports.Console({ |
62 | handleExcegiptions: true, | 62 | handleExceptions: true, |
63 | humanReadableUnhandledException: true, | 63 | humanReadableUnhandledException: true, |
64 | format: winston.format.combine( | 64 | format: winston.format.combine( |
65 | timestampFormatter, | 65 | timestampFormatter, |