From 768fd208507a4494d387ca858c79efe3acfd08a0 Mon Sep 17 00:00:00 2001 From: James Allen Date: Thu, 13 Feb 2014 12:37:23 +0000 Subject: [PATCH] Allow NewletterManager to be called without a callback --- .../web/app/coffee/managers/NewsletterManager.coffee | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/services/web/app/coffee/managers/NewsletterManager.coffee b/services/web/app/coffee/managers/NewsletterManager.coffee index 9bac0e7766..00297f7e67 100644 --- a/services/web/app/coffee/managers/NewsletterManager.coffee +++ b/services/web/app/coffee/managers/NewsletterManager.coffee @@ -4,7 +4,7 @@ logger = require 'logger-sharelatex' Settings = require 'settings-sharelatex' module.exports = - subscribe: (user, callback)-> + subscribe: (user, callback = () ->)-> if !Settings.markdownmail? logger.warn "No newsletter provider configured so not subscribing user" return callback() @@ -12,10 +12,9 @@ module.exports = options = buildOptions(user, true) Request.post options, (err, response, body)-> logger.log body:body, user:user, "finished attempting to subscribe the user to the news letter" - if callback? - callback err + callback(err) - unsubscribe: (user, callback)-> + unsubscribe: (user, callback = () ->)-> if !Settings.markdownmail? logger.warn "No newsletter provider configured so not unsubscribing user" return callback() @@ -23,7 +22,7 @@ module.exports = options = buildOptions(user, false) Request.post options, (err, response, body)-> logger.log err:err, body:body, email:user.email, "compled newsletter unsubscribe attempt" - callback() + callback(err) buildOptions = (user, is_subscribed)-> options =