mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	Migrate notify_settings to settings/notifications
Remove notify_settings from legacy_url.py
This commit is contained in:
		@@ -323,8 +323,8 @@ function _setup_page() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    function post_notify_settings_changes(notification_changes, success_func,
 | 
					    function post_notify_settings_changes(notification_changes, success_func,
 | 
				
			||||||
                                          error_func) {
 | 
					                                          error_func) {
 | 
				
			||||||
        return channel.post({
 | 
					        return channel.patch({
 | 
				
			||||||
            url: "/json/notify_settings/change",
 | 
					            url: "/json/settings/notifications",
 | 
				
			||||||
            data: notification_changes,
 | 
					            data: notification_changes,
 | 
				
			||||||
            success: success_func,
 | 
					            success: success_func,
 | 
				
			||||||
            error: error_func
 | 
					            error: error_func
 | 
				
			||||||
@@ -351,8 +351,8 @@ function _setup_page() {
 | 
				
			|||||||
    function update_global_stream_setting(notification_type, new_setting) {
 | 
					    function update_global_stream_setting(notification_type, new_setting) {
 | 
				
			||||||
        var data = {};
 | 
					        var data = {};
 | 
				
			||||||
        data[notification_type] = new_setting;
 | 
					        data[notification_type] = new_setting;
 | 
				
			||||||
        channel.post({
 | 
					        channel.patch({
 | 
				
			||||||
            url: "/json/notify_settings/change",
 | 
					            url: "/json/settings/notifications",
 | 
				
			||||||
            data: data,
 | 
					            data: data,
 | 
				
			||||||
            success: update_notification_settings_success,
 | 
					            success: update_notification_settings_success,
 | 
				
			||||||
            error: update_notification_settings_error
 | 
					            error: update_notification_settings_error
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1622,14 +1622,14 @@ class ChangeSettingsTest(ZulipTestCase):
 | 
				
			|||||||
    # This is basically a don't-explode test.
 | 
					    # This is basically a don't-explode test.
 | 
				
			||||||
    def test_notify_settings(self):
 | 
					    def test_notify_settings(self):
 | 
				
			||||||
        # type: () -> None
 | 
					        # type: () -> None
 | 
				
			||||||
        self.check_for_toggle_param("/json/notify_settings/change", "enable_desktop_notifications")
 | 
					        self.check_for_toggle_param_patch("/json/settings/notifications", "enable_desktop_notifications")
 | 
				
			||||||
        self.check_for_toggle_param("/json/notify_settings/change", "enable_stream_desktop_notifications")
 | 
					        self.check_for_toggle_param_patch("/json/settings/notifications", "enable_stream_desktop_notifications")
 | 
				
			||||||
        self.check_for_toggle_param("/json/notify_settings/change", "enable_stream_sounds")
 | 
					        self.check_for_toggle_param_patch("/json/settings/notifications", "enable_stream_sounds")
 | 
				
			||||||
        self.check_for_toggle_param("/json/notify_settings/change", "enable_sounds")
 | 
					        self.check_for_toggle_param_patch("/json/settings/notifications", "enable_sounds")
 | 
				
			||||||
        self.check_for_toggle_param("/json/notify_settings/change", "enable_offline_email_notifications")
 | 
					        self.check_for_toggle_param_patch("/json/settings/notifications", "enable_offline_email_notifications")
 | 
				
			||||||
        self.check_for_toggle_param("/json/notify_settings/change", "enable_offline_push_notifications")
 | 
					        self.check_for_toggle_param_patch("/json/settings/notifications", "enable_offline_push_notifications")
 | 
				
			||||||
        self.check_for_toggle_param("/json/notify_settings/change", "enable_online_push_notifications")
 | 
					        self.check_for_toggle_param_patch("/json/settings/notifications", "enable_online_push_notifications")
 | 
				
			||||||
        self.check_for_toggle_param("/json/notify_settings/change", "enable_digest_emails")
 | 
					        self.check_for_toggle_param_patch("/json/settings/notifications", "enable_digest_emails")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_ui_settings(self):
 | 
					    def test_ui_settings(self):
 | 
				
			||||||
        # type: () -> None
 | 
					        # type: () -> None
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -123,7 +123,6 @@ def update_display_settings_backend(request, user_profile,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    return json_success(result)
 | 
					    return json_success(result)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@authenticated_json_post_view
 | 
					 | 
				
			||||||
@has_request_variables
 | 
					@has_request_variables
 | 
				
			||||||
def json_change_notify_settings(request, user_profile,
 | 
					def json_change_notify_settings(request, user_profile,
 | 
				
			||||||
                                enable_stream_desktop_notifications=REQ(validator=check_bool,
 | 
					                                enable_stream_desktop_notifications=REQ(validator=check_bool,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,6 @@ legacy_urls = [
 | 
				
			|||||||
    url(r'^json/bulk_invite_users$',         zerver.views.invite.json_bulk_invite_users),
 | 
					    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/refer_friend$',              zerver.views.invite.json_refer_friend),
 | 
				
			||||||
    url(r'^json/settings/change$',           zerver.views.user_settings.json_change_settings),
 | 
					    url(r'^json/settings/change$',           zerver.views.user_settings.json_change_settings),
 | 
				
			||||||
    url(r'^json/notify_settings/change$',    zerver.views.user_settings.json_change_notify_settings),
 | 
					 | 
				
			||||||
    url(r'^json/ui_settings/change$',        zerver.views.user_settings.json_change_ui_settings),
 | 
					    url(r'^json/ui_settings/change$',        zerver.views.user_settings.json_change_ui_settings),
 | 
				
			||||||
    url(r'^json/subscriptions/remove$',      zerver.views.streams.json_remove_subscriptions),
 | 
					    url(r'^json/subscriptions/remove$',      zerver.views.streams.json_remove_subscriptions),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -246,8 +246,12 @@ v1_api_and_json_patterns = [
 | 
				
			|||||||
    url(r'^users/me/avatar$', rest_dispatch,
 | 
					    url(r'^users/me/avatar$', rest_dispatch,
 | 
				
			||||||
        {'PUT': 'zerver.views.user_settings.set_avatar_backend',
 | 
					        {'PUT': 'zerver.views.user_settings.set_avatar_backend',
 | 
				
			||||||
         'DELETE': 'zerver.views.user_settings.delete_avatar_backend'}),
 | 
					         'DELETE': 'zerver.views.user_settings.delete_avatar_backend'}),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # settings -> zerver.views.user_settings
 | 
				
			||||||
    url(r'^settings/display$', rest_dispatch,
 | 
					    url(r'^settings/display$', rest_dispatch,
 | 
				
			||||||
        {'PATCH': 'zerver.views.user_settings.update_display_settings_backend'}),
 | 
					        {'PATCH': 'zerver.views.user_settings.update_display_settings_backend'}),
 | 
				
			||||||
 | 
					    url(r'^settings/notifications$', rest_dispatch,
 | 
				
			||||||
 | 
					        {'PATCH': 'zerver.views.user_settings.json_change_notify_settings'}),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # users/me/alert_words -> zerver.views.alert_words
 | 
					    # users/me/alert_words -> zerver.views.alert_words
 | 
				
			||||||
    url(r'^users/me/alert_words$', rest_dispatch,
 | 
					    url(r'^users/me/alert_words$', rest_dispatch,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user