From 46afe3be69a00f9cb24b23bcd657dcc183507b63 Mon Sep 17 00:00:00 2001 From: Jessica McKellar Date: Thu, 27 Jun 2013 10:44:05 -0400 Subject: [PATCH] views: remove now-unused tutorial message sending capabilities. (imported from commit 65d14bf469f64b47cf682f4fb36946c6d841eebd) --- humbug/urls.py | 1 - zephyr/models.py | 7 ------- zephyr/views.py | 37 ------------------------------------- 3 files changed, 45 deletions(-) diff --git a/humbug/urls.py b/humbug/urls.py index a81b347d86..d4303bbfad 100644 --- a/humbug/urls.py +++ b/humbug/urls.py @@ -100,7 +100,6 @@ urlpatterns += patterns('zephyr.views', url(r'^json/get_members$', 'json_get_members'), url(r'^json/update_active_status$', 'json_update_active_status'), url(r'^json/get_active_statuses$', 'json_get_active_statuses'), - url(r'^json/tutorial_send_message$', 'json_tutorial_send_message'), url(r'^json/tutorial_status$', 'json_tutorial_status'), url(r'^json/change_enter_sends$', 'json_change_enter_sends'), url(r'^json/get_profile$', 'json_get_profile'), diff --git a/zephyr/models.py b/zephyr/models.py index 2c02c780c0..1ccde08ccc 100644 --- a/zephyr/models.py +++ b/zephyr/models.py @@ -118,13 +118,6 @@ class UserProfile(AbstractBaseUser): # completed. onboarding_steps = models.TextField(default=ujson.dumps([])) - def tutorial_stream_name(self): - # If you change this, you need to change the corresponding - # client-computed version of it in tutorial.js - long_name = "tutorial-%s" % (self.email.split('@')[0],) - short_name = long_name[:Stream.MAX_NAME_LENGTH] - return short_name - objects = UserManager() def __repr__(self): diff --git a/zephyr/views.py b/zephyr/views.py index 288f12bf29..24e1efe3ca 100644 --- a/zephyr/views.py +++ b/zephyr/views.py @@ -1045,43 +1045,6 @@ def create_mirrored_message_users(request, user_profile, recipients): sender = get_user_profile_by_email(sender_email) return (True, sender) -@authenticated_json_post_view -@has_request_variables -def json_tutorial_send_message(request, user_profile, - message_type_name = REQ('type'), - subject_name = REQ('subject', lambda x: x.strip(), None), - message_content = REQ('content')): - """ - This function, used by the onboarding tutorial, causes the - Tutorial Bot to send you the message you pass in here. - (That way, the Tutorial Bot's messages to you get rendered - by the server and therefore look like any other message.) - """ - sender_name = "humbug+tutorial@humbughq.com" - if message_type_name == 'private': - # For now, we discard the recipient on PMs; the tutorial bot - # can only send to you. - internal_send_message(sender_name, - "private", - user_profile.email, - "", - message_content, - realm=user_profile.realm) - return json_success() - elif message_type_name == 'stream': - tutorial_stream_name = user_profile.tutorial_stream_name() - ## TODO: For open realms, we need to use the full name here, - ## so that me@gmail.com and me@hotmail.com don't get the same stream. - internal_send_message(sender_name, - "stream", - tutorial_stream_name, - subject_name, - message_content, - realm=user_profile.realm) - return json_success() - return json_error('Bad data passed in to tutorial_send_message') - - @authenticated_json_post_view @has_request_variables def json_tutorial_status(request, user_profile, status=REQ('status')):