mirror of
https://github.com/zulip/zulip.git
synced 2025-11-12 18:06:44 +00:00
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:
@@ -705,10 +705,13 @@ def do_finish_tutorial(user_profile):
|
|||||||
# We want to add the default subs list iff there were no subs
|
# We want to add the default subs list iff there were no subs
|
||||||
try:
|
try:
|
||||||
prereg_user = PreregistrationUser.objects.get(email=user_profile.email)
|
prereg_user = PreregistrationUser.objects.get(email=user_profile.email)
|
||||||
except PreregistrationUser.DoesNotExist:
|
|
||||||
return
|
|
||||||
|
|
||||||
streams = prereg_user.streams.all()
|
streams = prereg_user.streams.all()
|
||||||
|
except PreregistrationUser.DoesNotExist:
|
||||||
|
# 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 = []
|
||||||
|
|
||||||
if len(streams) == 0:
|
if len(streams) == 0:
|
||||||
streams = get_default_subs(user_profile)
|
streams = get_default_subs(user_profile)
|
||||||
for stream in streams:
|
for stream in streams:
|
||||||
|
|||||||
Reference in New Issue
Block a user