From c6da73ade9967c38d0218ff71cc8c683ac6a7705 Mon Sep 17 00:00:00 2001 From: Jessica McKellar Date: Wed, 8 May 2013 09:28:27 -0400 Subject: [PATCH] onboarding: add endpoint for updating your onboarding steps. (imported from commit 30c326b50cd2273099aa464f2d9502f929a3d48f) --- humbug/urls.py | 1 + zephyr/views.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/humbug/urls.py b/humbug/urls.py index a8f4d94b3a..b3e87f10c9 100644 --- a/humbug/urls.py +++ b/humbug/urls.py @@ -102,6 +102,7 @@ urlpatterns += patterns('zephyr.views', url(r'^json/messages_in_narrow$', 'json_messages_in_narrow'), url(r'^json/create_bot$', 'json_create_bot'), url(r'^json/get_bots$', 'json_get_bots'), + url(r'^json/update_onboarding_steps$', 'json_update_onboarding_steps'), # These are json format views used by the API. They require an API key. url(r'^api/v1/get_profile$', 'api_get_profile'), diff --git a/zephyr/views.py b/zephyr/views.py index 6d6d956050..b7992c77d4 100644 --- a/zephyr/views.py +++ b/zephyr/views.py @@ -29,7 +29,8 @@ from zephyr.lib.actions import do_add_subscription, do_remove_subscription, \ create_stream_if_needed, gather_subscriptions, subscribed_to_stream, \ update_user_presence, set_stream_color, get_stream_colors, update_message_flags, \ recipient_for_emails, extract_recipients, do_events_register, do_finish_tutorial, \ - get_status_dict, do_change_enable_offline_email_notifications + get_status_dict, do_change_enable_offline_email_notifications, \ + do_update_onboarding_steps from zephyr.forms import RegistrationForm, HomepageForm, ToSForm, CreateBotForm, \ is_unique, is_inactive, isnt_mit from django.views.decorators.csrf import csrf_exempt @@ -902,6 +903,14 @@ def json_change_enter_sends(request, user_profile, do_change_enter_sends(user_profile, enter_sends) return json_success() +@authenticated_json_post_view +@has_request_variables +def json_update_onboarding_steps(request, user_profile, + onboarding_steps=REQ(converter=json_to_list, + default=[])): + do_update_onboarding_steps(user_profile, onboarding_steps) + return json_success() + # Currently tabbott/extra@mit.edu is our only superuser. TODO: Make # this a real superuser security check. def is_super_user_api(request):