onboarding: give new users a list of uncompleted onboarding steps.

(imported from commit 068a6e2112db98965ec5a1c5fc69a9fe285c0333)
This commit is contained in:
Jessica McKellar
2013-05-08 09:27:27 -04:00
parent b5e22bf6b6
commit 24bb8ad797
2 changed files with 12 additions and 1 deletions

View File

@@ -768,6 +768,10 @@ def subscribed_to_stream(user_profile, stream):
except Subscription.DoesNotExist: except Subscription.DoesNotExist:
return False return False
def do_update_onboarding_steps(user_profile, steps):
user_profile.onboarding_steps = simplejson.dumps(steps)
user_profile.save()
def do_finish_tutorial(user_profile): def do_finish_tutorial(user_profile):
user_profile.tutorial_status = UserProfile.TUTORIAL_FINISHED user_profile.tutorial_status = UserProfile.TUTORIAL_FINISHED
user_profile.save() user_profile.save()

View File

@@ -7,6 +7,12 @@ from zephyr.lib.initial_password import initial_api_key
from zephyr.models import UserProfile, Recipient, Subscription from zephyr.models import UserProfile, Recipient, Subscription
import base64 import base64
import hashlib import hashlib
import simplejson
onboarding_steps = ["sent_stream_message", "sent_private_message", "made_app_sticky"]
def create_onboarding_steps_blob():
return simplejson.dumps([(step, False) for step in onboarding_steps])
# create_user_profile is based on Django's User.objects.create_user, # create_user_profile is based on Django's User.objects.create_user,
# except that we don't save to the database so it can used in # except that we don't save to the database so it can used in
@@ -21,7 +27,8 @@ def create_user_profile(realm, email, password, active, bot, full_name, short_na
user_profile = UserProfile(email=email, is_staff=False, is_active=active, user_profile = UserProfile(email=email, is_staff=False, is_active=active,
full_name=full_name, short_name=short_name, full_name=full_name, short_name=short_name,
last_login=now, date_joined=now, realm=realm, last_login=now, date_joined=now, realm=realm,
pointer=-1, is_bot=bot, bot_owner=bot_owner) pointer=-1, is_bot=bot, bot_owner=bot_owner,
onboarding_steps=create_onboarding_steps_blob())
if bot or not active: if bot or not active:
user_profile.set_unusable_password() user_profile.set_unusable_password()