[Fix bug 921107] Update email in Exact Target #833

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@dpoirier

When someone changes their email in Mozillians.org, move their exact
target subscriptions to the new email address.

Also take advantage of new basket subscribe(sync=Y) to simplify
the update tasks.

@dpoirier dpoirier [Fix bug 921107] Update email in exact target
When someone changes their email in Mozillians.org, move their exact
target subscriptions to the new email address.

Also take advantage of new basket subscribe(sync=Y) to simplify
the update tasks.
4a47f3a
@dpoirier

This is a large-ish change. The rationale is that now basket has a way we can do subscribes synchronously again, so we can rely on getting back the new token immediately, and can remove the code that we needed in order to look up the token later.

@glogiotatidis glogiotatidis commented on the diff Mar 24, 2014
mozillians/users/tasks.py
@@ -93,23 +99,57 @@ def update_basket_task(instance_id):
_email_basket_managers('subscribe', instance.user.email,
exception.message)
return
- # Schedule the phonebook update - if we don't have a token yet,
- # phonebook update will look it up. But delay running it for a few
- # seconds to give Basket a chance to already have the token.
- update_basket_phonebook_task.apply_async(args=[instance.user.pk], countdown=10)
-
+ # Remember the token
+ instance.basket_token = token = retval['token']
+ # Don't call .save() on a userprofile from here, it would invoke us again
+ # via the post-save signal, which would be pointless.
+ UserProfile.objects.filter(pk=instance.pk).update(basket_token=token)
@glogiotatidis
glogiotatidis Mar 24, 2014

This block, starting from line 102, is both in if and else (line 148). Let's move it after else ends.

@glogiotatidis glogiotatidis commented on the diff Mar 24, 2014
mozillians/users/tasks.py
@@ -93,23 +99,57 @@ def update_basket_task(instance_id):
_email_basket_managers('subscribe', instance.user.email,
exception.message)
return
- # Schedule the phonebook update - if we don't have a token yet,
- # phonebook update will look it up. But delay running it for a few
- # seconds to give Basket a chance to already have the token.
- update_basket_phonebook_task.apply_async(args=[instance.user.pk], countdown=10)
-
+ # Remember the token
+ instance.basket_token = token = retval['token']
@glogiotatidis
glogiotatidis Mar 24, 2014

Do you mind changing this into two lines for readability?

@glogiotatidis
Mozilla member

https://github.com/mozilla/mozillians/pull/833/files#diff-266059f660d7f465446b47aa47888d1dR160

Can you change this line to include functional areas and not just curated groups? Before the "curated groups" changes, functional areas were the only groups with curators therefore we used to filters them this way.

@glogiotatidis
Mozilla member

To make sure I understand it correctly:

  • I 'm subscribed to 4 mozilla newsletters including mozillians.org newsletter with address foo@example.com
  • I change my address on mozillians.org to bar@example.com
  • All my 4 subscriptions now go to bar@example.com?
@glogiotatidis
Mozilla member

I understand from the bug that we should only change "phonebook" newsletter subscription? @dpoirier can you please verify? If you don't have the time to work on this I can take over.

@dpoirier

@glogiotatidis I don't really know. I was assuming that someone changing their email address on mozillians would want all their subscriptions moved, but that might not be what was intended by this feature.

@dpoirier

It sounds like the equivalent of the old exclude(curator=None) would be filter(functional_area=True)?

Unfortunately I won't have time to continue working on this, but all these comments seem reasonable.

@glogiotatidis
Mozilla member

OK i'll take over from now on. Thanks for working on this @dpoirier

@glogiotatidis
Mozilla member

Moved here #872

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment