API: Migrate POST `/ui_settings/change` to PATCH `/settings/ui`

This commit is contained in:
Rafid Aslam 2016-12-22 09:36:18 +07:00 committed by showell
parent 5f77ce1ce8
commit d0502537ab
5 changed files with 6 additions and 6 deletions

View File

@ -769,8 +769,8 @@ function _setup_page() {
labs_updates[setting] = $("#" + setting).is(":checked");
});
channel.post({
url: '/json/ui_settings/change',
channel.patch({
url: '/json/settings/ui',
data: labs_updates,
success: function (resp, statusText, xhr) {
var message = i18n.t("Updated __product_name__ Labs settings! You will need to reload for these changes to take effect.", page_params);

View File

@ -1633,8 +1633,8 @@ class ChangeSettingsTest(ZulipTestCase):
def test_ui_settings(self):
# type: () -> None
self.check_for_toggle_param("/json/ui_settings/change", "autoscroll_forever")
self.check_for_toggle_param("/json/ui_settings/change", "default_desktop_notifications")
self.check_for_toggle_param_patch("/json/settings/ui", "autoscroll_forever")
self.check_for_toggle_param_patch("/json/settings/ui", "default_desktop_notifications")
def test_toggling_left_side_userlist(self):
# type: () -> None

View File

@ -25,7 +25,6 @@ from zerver.lib.validator import check_bool, check_string
from zerver.lib.request import JsonableError
from zerver.models import UserProfile, Realm, name_changes_disabled
@authenticated_json_post_view
@has_request_variables
def json_change_ui_settings(request, user_profile,
autoscroll_forever=REQ(validator=check_bool,

View File

@ -17,7 +17,6 @@ legacy_urls = [
url(r'^json/bulk_invite_users$', zerver.views.invite.json_bulk_invite_users),
url(r'^json/refer_friend$', zerver.views.invite.json_refer_friend),
url(r'^json/settings/change$', zerver.views.user_settings.json_change_settings),
url(r'^json/ui_settings/change$', zerver.views.user_settings.json_change_ui_settings),
# We should remove this endpoint and all code related to it.
# It returns a 404 if the stream doesn't exist, which is confusing

View File

@ -253,6 +253,8 @@ v1_api_and_json_patterns = [
{'PATCH': 'zerver.views.user_settings.update_display_settings_backend'}),
url(r'^settings/notifications$', rest_dispatch,
{'PATCH': 'zerver.views.user_settings.json_change_notify_settings'}),
url(r'^settings/ui$', rest_dispatch,
{'PATCH': 'zerver.views.user_settings.json_change_ui_settings'}),
# users/me/alert_words -> zerver.views.alert_words
url(r'^users/me/alert_words$', rest_dispatch,