Permalink
Browse files

Remove the users controller decorate since we are now doing the Mailc…

…himp stuff through model callbacks
  • Loading branch information...
jkongie committed Apr 19, 2012
1 parent d8c8b8f commit fb0aeadf52410f1bbc02d7062f3430cb1172e7cb
Showing with 2 additions and 29 deletions.
  1. +0 −28 app/controllers/spree/users_controller_decorator.rb
  2. +2 −1 app/models/user_decorator.rb
@@ -1,28 +0,0 @@
-Spree::UsersController.class_eval do
-
- after_filter :update_in_mailchimp, :only => [:update]
-
- def hominid
- Hominid::API.new(Spree::Config.get(:mailchimp_api_key))
- end
-
- def mc_list_id
- Spree::Config.get(:mailchimp_list_id)
- end
-
- private
-
- def update_in_mailchimp
- if params && params[:user] && params[:user][:is_mail_list_subscriber] # works if not checked because 0 is true
-
- if params[:user][:is_mail_list_subscriber].to_i.equal?(1) && !@user.mailchimp_subscriber_id.blank?
- Spree::User.benchmark "Updating mailchimp subscriber (list id=#{mc_list_id}, member=#{@user.mailchimp_subscriber_id})" do
- hominid.update_member(mc_list_id, @user.mailchimp_subscriber_id, {:EMAIL => @user.email})
- end
- end
- end
- rescue Hominid::APIError => e
- logger.warn "MailChimp::Sync: Failed to update mailchimp record for user id=#{@user.id}"
- end
-
-end
@@ -41,7 +41,8 @@ def mailchimp_remove_from_mailing_list
# Updates Mailchimp
#
# Returns nothing
- # TODO: Update the user's email address in Mailchimp if it changes
+ # TODO: Update the user's email address in Mailchimp if it changes.
+ # Look at listMemberUpdate
def mailchimp_update_in_mailing_list
if self.is_mail_list_subscriber?
mailchimp_add_to_mailing_list

0 comments on commit fb0aead

Please sign in to comment.