Clean up legacy language_settings endpoint.

This commit is contained in:
anirudhjain75 2016-12-22 14:24:27 +05:30 committed by Tim Abbott
parent 5cd6ff20b0
commit c9db6b6658
5 changed files with 6 additions and 6 deletions

View File

@ -461,7 +461,7 @@ function _setup_page() {
context.lang = new_language;
channel.patch({
url: '/json/language_setting',
url: '/json/settings/display',
data: data,
success: function () {
ui.report_success(i18n.t("__lang__ is now the default language! You will need to reload the window for your changes to take effect", context),

View File

@ -1677,7 +1677,7 @@ class ChangeSettingsTest(ZulipTestCase):
self.login(email)
german = "de"
data = dict(default_language=ujson.dumps(german))
result = self.client_post("/json/language_setting", data)
result = self.client_patch("/json/settings/display", data)
self.assert_json_success(result)
user_profile = get_user_profile_by_email(email)
self.assertEqual(user_profile.default_language, german)
@ -1686,7 +1686,7 @@ class ChangeSettingsTest(ZulipTestCase):
# and saved in the db.
invalid_lang = "invalid_lang"
data = dict(default_language=ujson.dumps(invalid_lang))
result = self.client_post("/json/language_setting", data)
result = self.client_patch("/json/settings/display", data)
self.assert_json_error(result, "Invalid language '%s'" % (invalid_lang,))
user_profile = get_user_profile_by_email(email)
self.assertNotEqual(user_profile.default_language, invalid_lang)

View File

@ -122,7 +122,6 @@ def json_left_side_userlist(request, user_profile, left_side_userlist=REQ(valida
return json_success(result)
@authenticated_json_post_view
@has_request_variables
def json_language_setting(request, user_profile, default_language=REQ(validator=check_string, default=None)):
# type: (HttpRequest, UserProfile, Optional[str]) -> HttpResponse

View File

@ -45,5 +45,4 @@ legacy_urls = [
url(r'^json/set_muted_topics$', zerver.views.json_set_muted_topics),
url(r'^json/time_setting$', zerver.views.user_settings.json_time_setting),
url(r'^json/left_side_userlist$', zerver.views.user_settings.json_left_side_userlist),
url(r'^json/language_setting$', zerver.views.user_settings.json_language_setting),
]
]

View File

@ -246,6 +246,8 @@ v1_api_and_json_patterns = [
url(r'^users/me/avatar$', rest_dispatch,
{'PUT': 'zerver.views.user_settings.set_avatar_backend',
'DELETE': 'zerver.views.user_settings.delete_avatar_backend'}),
url(r'^settings/display$', rest_dispatch,
{'PATCH': 'zerver.views.user_settings.json_language_setting'}),
# users/me/alert_words -> zerver.views.alert_words
url(r'^users/me/alert_words$', rest_dispatch,