Future-proof adding new users to default streams.

The previous code for adding users to default streams wouldn't do so
if the user didn't have a PreregistrationUser row.

(imported from commit 25f1383f6771319542d07660b29d891368889212)
This commit is contained in:
Tim Abbott 2013-04-05 12:34:10 -04:00
parent 1b11eeb2bc
commit ea95a8b167
1 changed files with 5 additions and 2 deletions

View File

@ -705,10 +705,13 @@ def do_finish_tutorial(user_profile):
# We want to add the default subs list iff there were no subs
try:
prereg_user = PreregistrationUser.objects.get(email=user_profile.email)
streams = prereg_user.streams.all()
except PreregistrationUser.DoesNotExist:
return
# If the user signed up via a mechanism other than
# PreregistrationUser (e.g. Google Apps connect or MitUser),
# just give them the default streams.
streams = []
streams = prereg_user.streams.all()
if len(streams) == 0:
streams = get_default_subs(user_profile)
for stream in streams: