mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-20 05:11:52 +00: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
|
delete options.body.status
|
||||||
options.body.email_address = newEmail
|
options.body.email_address = newEmail
|
||||||
mailchimp.request options, (err)->
|
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 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"
|
logger.err err:err, "error changing email in newsletter"
|
||||||
return callback(err)
|
return callback(err)
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue