diff --git a/zerver/views/__init__.py b/zerver/views/__init__.py index a26383b3c6..6dbd92bd10 100644 --- a/zerver/views/__init__.py +++ b/zerver/views/__init__.py @@ -2018,10 +2018,9 @@ def get_status_list(requesting_user_profile): return {'presences': get_status_dict(requesting_user_profile), 'server_timestamp': time.time()} -@authenticated_json_post_view @has_request_variables -def json_update_active_status(request, user_profile, status=REQ, - new_user_input=REQ(converter=json_to_bool, default=False)): +def update_active_status_backend(request, user_profile, status=REQ, + new_user_input=REQ(converter=json_to_bool, default=False)): status_val = UserPresence.status_from_string(status) if status_val is None: raise JsonableError("Invalid presence status: %s" % (status,)) @@ -2044,6 +2043,10 @@ def json_update_active_status(request, user_profile, status=REQ, return json_success(ret) +@authenticated_json_post_view +def json_update_active_status(request, user_profile): + return update_active_status_backend(request, user_profile) + @authenticated_json_post_view def json_get_active_statuses(request, user_profile): return json_success(get_status_list(user_profile)) diff --git a/zproject/urls.py b/zproject/urls.py index a477fb262c..40894723a2 100644 --- a/zproject/urls.py +++ b/zproject/urls.py @@ -205,6 +205,8 @@ v1_api_and_json_patterns = patterns('zerver.views', 'DELETE': 'remove_alert_words'}), url(r'^users/me/api_key/regenerate$', 'rest_dispatch', {'POST': 'regenerate_api_key'}), + url(r'^users/me/presence$', 'rest_dispatch', + {'POST': 'update_active_status_backend'}), # Endpoint used by iOS devices to register their # unique APNS device token url(r'^users/me/apns_device_token$', 'rest_dispatch',