From 526de3f7d1dab6bd5dc29285f476973739cb5379 Mon Sep 17 00:00:00 2001 From: Sahil Batra Date: Thu, 9 Sep 2021 15:36:19 +0530 Subject: [PATCH] settings: Remove unnecessary loop of notification_setting_types. We still used notification_setting_types in copy_user_settings function of create_user.py and in a test in test_event_system.py. It is not required to do so since we have added all settings in property_types already and we loop over property_types at both these places which includes all settings. --- zerver/lib/create_user.py | 4 ---- zerver/tests/test_event_system.py | 6 ------ 2 files changed, 10 deletions(-) diff --git a/zerver/lib/create_user.py b/zerver/lib/create_user.py index db4eb646d1..6fe28f5a0f 100644 --- a/zerver/lib/create_user.py +++ b/zerver/lib/create_user.py @@ -21,10 +21,6 @@ def copy_user_settings(source_profile: UserProfile, target_profile: UserProfile) value = getattr(source_profile, settings_name) setattr(target_profile, settings_name, value) - for settings_name in UserProfile.notification_setting_types: - value = getattr(source_profile, settings_name) - setattr(target_profile, settings_name, value) - setattr(target_profile, "full_name", source_profile.full_name) setattr(target_profile, "enter_sends", source_profile.enter_sends) setattr(target_profile, "timezone", source_profile.timezone) diff --git a/zerver/tests/test_event_system.py b/zerver/tests/test_event_system.py index 3c71c9b867..b5770dd3fb 100644 --- a/zerver/tests/test_event_system.py +++ b/zerver/tests/test_event_system.py @@ -557,9 +557,6 @@ class FetchInitialStateDataTest(ZulipTestCase): for prop in UserProfile.property_types: self.assertNotIn(prop, result) self.assertIn(prop, result["user_settings"]) - for prop in UserProfile.notification_setting_types: - self.assertNotIn(prop, result) - self.assertIn(prop, result["user_settings"]) result = fetch_initial_state_data( user_profile=hamlet, @@ -569,9 +566,6 @@ class FetchInitialStateDataTest(ZulipTestCase): for prop in UserProfile.property_types: self.assertIn(prop, result) self.assertIn(prop, result["user_settings"]) - for prop in UserProfile.notification_setting_types: - self.assertIn(prop, result) - self.assertIn(prop, result["user_settings"]) class ClientDescriptorsTest(ZulipTestCase):