diff options
author | Chocobozzz <me@florianbigard.com> | 2020-02-17 10:27:00 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-02-17 10:27:00 +0100 |
commit | 4c1c17093461b58d3ee3f23f239e340d8dac1149 (patch) | |
tree | 236b724f1415a812a4274fd63b519124cba2e42f /server/middlewares/validators/server.ts | |
parent | 45f1bd72a08998c60a9dd68ff069cea9de39161c (diff) | |
download | PeerTube-4c1c17093461b58d3ee3f23f239e340d8dac1149.tar.gz PeerTube-4c1c17093461b58d3ee3f23f239e340d8dac1149.tar.zst PeerTube-4c1c17093461b58d3ee3f23f239e340d8dac1149.zip |
Refactor email enabled function
Diffstat (limited to 'server/middlewares/validators/server.ts')
-rw-r--r-- | server/middlewares/validators/server.ts | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/server/middlewares/validators/server.ts b/server/middlewares/validators/server.ts index f6812647b..6158c3363 100644 --- a/server/middlewares/validators/server.ts +++ b/server/middlewares/validators/server.ts | |||
@@ -5,9 +5,8 @@ import { isHostValid, isValidContactBody } from '../../helpers/custom-validators | |||
5 | import { ServerModel } from '../../models/server/server' | 5 | import { ServerModel } from '../../models/server/server' |
6 | import { body } from 'express-validator' | 6 | import { body } from 'express-validator' |
7 | import { isUserDisplayNameValid } from '../../helpers/custom-validators/users' | 7 | import { isUserDisplayNameValid } from '../../helpers/custom-validators/users' |
8 | import { Emailer } from '../../lib/emailer' | ||
9 | import { Redis } from '../../lib/redis' | 8 | import { Redis } from '../../lib/redis' |
10 | import { CONFIG } from '../../initializers/config' | 9 | import { CONFIG, isEmailEnabled } from '../../initializers/config' |
11 | 10 | ||
12 | const serverGetValidator = [ | 11 | const serverGetValidator = [ |
13 | body('host').custom(isHostValid).withMessage('Should have a valid host'), | 12 | body('host').custom(isHostValid).withMessage('Should have a valid host'), |
@@ -50,7 +49,7 @@ const contactAdministratorValidator = [ | |||
50 | .end() | 49 | .end() |
51 | } | 50 | } |
52 | 51 | ||
53 | if (Emailer.isEnabled() === false) { | 52 | if (isEmailEnabled() === false) { |
54 | return res | 53 | return res |
55 | .status(409) | 54 | .status(409) |
56 | .send({ error: 'Emailer is not enabled on this instance.' }) | 55 | .send({ error: 'Emailer is not enabled on this instance.' }) |