Merge pull request #1717 from overleaf/as-decaffeinate-backend

Decaffeinate backend

GitOrigin-RevId: 4ca9f94fc809cab6f47cec8254cacaf1bb3806fa
This commit is contained in:
Alasdair Smith
2019-05-29 10:21:06 +01:00
committed by sharelatex
parent d4eb71b525
commit 0ca81de78c
863 changed files with 177442 additions and 58929 deletions

View File

@@ -0,0 +1,34 @@
/* eslint-disable
handle-callback-err,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const settings = require('settings-sharelatex')
const EmailBuilder = require('./EmailBuilder')
const EmailSender = require('./EmailSender')
if (settings.email == null) {
settings.email = { lifecycleEnabled: false }
}
module.exports = {
sendEmail(emailType, opts, callback) {
if (callback == null) {
callback = function(err) {}
}
const email = EmailBuilder.buildEmail(emailType, opts)
if (email.type === 'lifecycle' && !settings.email.lifecycle) {
return callback()
}
opts.html = email.html
opts.text = email.text
opts.subject = email.subject
return EmailSender.sendEmail(opts, err => callback(err))
}
}