[manual] Add back json_tutorial_send_message endpoint.

Before deploying to staging, create the tutorial bot:

email: welcome-bot@zulip.com
name: Zulip Welcome Bot

(imported from commit 2f337a00ffac888b121975bdb95a89cf2f8ab3a7)
This commit is contained in:
Jessica McKellar
2014-01-14 18:06:20 -05:00
parent fcd89d5861
commit a62c720e0e
3 changed files with 24 additions and 1 deletions

View File

@@ -1001,6 +1001,25 @@ def json_change_enter_sends(request, user_profile,
do_change_enter_sends(user_profile, enter_sends) do_change_enter_sends(user_profile, enter_sends)
return json_success() return json_success()
@authenticated_json_post_view
@has_request_variables
def json_tutorial_send_message(request, user_profile, type=REQ,
recipient=REQ, topic=REQ, content=REQ):
"""
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 = "welcome-bot@zulip.com"
if type == 'stream':
internal_send_message(sender_name, "stream", recipient, topic, content,
realm=user_profile.realm)
return json_success()
# For now, there are no PM cases.
return json_error('Bad data passed in to tutorial_send_message')
@authenticated_json_post_view @authenticated_json_post_view
@has_request_variables @has_request_variables
def json_tutorial_status(request, user_profile, status=REQ('status')): def json_tutorial_status(request, user_profile, status=REQ('status')):

View File

@@ -336,7 +336,10 @@ INTERNAL_BOTS = [ {'var_name': 'NOTIFICATION_BOT',
'name': 'Nagios Send Bot'}, 'name': 'Nagios Send Bot'},
{'var_name': 'NAGIOS_RECEIVE_BOT', {'var_name': 'NAGIOS_RECEIVE_BOT',
'email_template': 'nagios-receive-bot@%s', 'email_template': 'nagios-receive-bot@%s',
'name': 'Nagios Receive Bot'} ] 'name': 'Nagios Receive Bot'},
{'var_name': 'WELCOME_BOT',
'email_template': 'welcome-bot@%s',
'name': 'Welcome Bot'} ]
INTERNAL_BOT_DOMAIN = "zulip.com" INTERNAL_BOT_DOMAIN = "zulip.com"

View File

@@ -123,6 +123,7 @@ urlpatterns += patterns('zerver.views',
url(r'^json/fetch_api_key$', 'json_fetch_api_key'), url(r'^json/fetch_api_key$', 'json_fetch_api_key'),
url(r'^json/update_active_status$', 'json_update_active_status'), url(r'^json/update_active_status$', 'json_update_active_status'),
url(r'^json/get_active_statuses$', 'json_get_active_statuses'), 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/tutorial_status$', 'json_tutorial_status'),
url(r'^json/change_enter_sends$', 'json_change_enter_sends'), url(r'^json/change_enter_sends$', 'json_change_enter_sends'),
url(r'^json/get_profile$', 'json_get_profile'), url(r'^json/get_profile$', 'json_get_profile'),