Merge pull request #859 from sharelatex/ho-mailchimp-change-email

always set status_if_new
This commit is contained in:
Timothée Alby 2018-08-28 14:44:59 +02:00 committed by GitHub
commit 107e8ce633

View file

@ -59,16 +59,17 @@ hashEmail = (email)->
buildOptions = (user, is_subscribed)->
subscriber_hash = hashEmail(user.email)
status = if is_subscribed then "subscribed" else "unsubscribed"
opts =
method: "PUT"
path: "/lists/#{Settings.mailchimp?.list_id}/members/#{subscriber_hash}"
body:
email_address:user.email
status_if_new: status
status = if is_subscribed then "subscribed" else "unsubscribed"
#only set status if we explictly want to set it
if is_subscribed?
opts.body.status = status
opts.body.status_if_new = status
if user._id?
opts.body.merge_fields =