mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
add error handling for changing email in newsletter of user who has not subscribed
This commit is contained in:
parent
740571475c
commit
75521a4c86
1 changed files with 4 additions and 1 deletions
|
@ -39,8 +39,11 @@ module.exports =
|
|||
delete options.body.status
|
||||
options.body.email_address = newEmail
|
||||
mailchimp.request options, (err)->
|
||||
if err? and err?.message?.indexOf("merge fields were invalid")
|
||||
logger.log {oldEmail, newEmail}, "unable to change email in newsletter as user has not subscribed"
|
||||
return callback()
|
||||
# if the user has unsubscribed mailchimp will error on email address change
|
||||
if err? and err?.message.indexOf("could not be validated") == -1
|
||||
else if err? and err?.message?.indexOf("could not be validated") == -1
|
||||
logger.err err:err, "error changing email in newsletter"
|
||||
return callback(err)
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue