app/models/kits/mailchimp_kit.rb in artfully_ose-1.2.0.pre.23 vs app/models/kits/mailchimp_kit.rb in artfully_ose-1.2.0.pre.24
- old
+ new
@@ -129,11 +129,13 @@
:first_name => member["First Name"],
:last_name => member["Last Name"],
:email => member["Email Address"],
:skip_sync_to_mailchimp => true,
:subscribed_lists => [list_id]
- })
+ }) do |person|
+ person.skip_commit = true
+ end
note = person.notes.build({
:text => "Imported from MailChimp",
:occurred_at => Time.now
})
note.organization_id = organization_id
@@ -258,11 +260,11 @@
return if person.nil?
reason = (data["reason"] == "hard" ? "a hard bounce" : "abuse")
person.subscribed_lists.delete(list_id)
person.new_note("MailChimp cleaned #{person.email} from #{list_name(list_id)} because of #{reason}.", Time.now, nil, organization_id)
- puts person.save
+ person.save
end
def sync_mailchimp_webhook_update_person_email(list_id, data)
person = organization.people.find_by_email(data["old_email"])
return if person.nil? || person.do_not_email?
@@ -371,10 +373,10 @@
@mailchimp_list_members ||= members.collect do |member|
member_hash = {}
mailchimp_attributes.inject({}) do |member_hash, attribute|
- member_hash[attribute] = member[headers.index(attribute)]
+ member_hash[attribute] = member[headers.index(attribute)] unless headers.index(attribute).nil?
member_hash
end
end
end