From 4c1c17093461b58d3ee3f23f239e340d8dac1149 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 17 Feb 2020 10:27:00 +0100 Subject: Refactor email enabled function --- server/lib/emailer.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'server/lib') diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts index 0f74d2a8c..d0874ab20 100644 --- a/server/lib/emailer.ts +++ b/server/lib/emailer.ts @@ -1,7 +1,7 @@ import { createTransport, Transporter } from 'nodemailer' import { isTestInstance } from '../helpers/core-utils' import { bunyanLogger, logger } from '../helpers/logger' -import { CONFIG } from '../initializers/config' +import { CONFIG, isEmailEnabled } from '../initializers/config' import { JobQueue } from './job-queue' import { EmailPayload } from './job-queue/handlers/email' import { readFileSync } from 'fs-extra' @@ -40,7 +40,7 @@ class Emailer { if (this.initialized === true) return this.initialized = true - if (Emailer.isEnabled()) { + if (isEmailEnabled) { logger.info('Using %s:%s as SMTP server.', CONFIG.SMTP.HOSTNAME, CONFIG.SMTP.PORT) let tls @@ -459,7 +459,7 @@ class Emailer { } async sendMail (options: EmailPayload) { - if (!Emailer.isEnabled()) { + if (!isEmailEnabled()) { throw new Error('Cannot send mail because SMTP is not configured.') } -- cgit v1.2.3