From 880133295ed90e414adc00b98192ce782b9112ae Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 4 Jan 2024 17:43:54 -0800 Subject: [PATCH] zilencer: Skip deactivating registrations when locally deleted. This protects us from incorrectly handling situations where someone tested and upgrade to 8.0 for a backup on a separate hostname, and left the test system live while upgrading the main system, in a way that results in duplicate RemoteRealm objects that are all marked as locally deleted. Further word is required to figure out how to avoid the original duplication problem. --- zerver/tests/test_push_notifications.py | 3 ++- zilencer/views.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.py index b092d613ae..d71546fc8e 100644 --- a/zerver/tests/test_push_notifications.py +++ b/zerver/tests/test_push_notifications.py @@ -2417,7 +2417,8 @@ class AnalyticsBouncerTest(BouncerTestCase): logger.warning("Dummy warning") send_server_data_to_push_bouncer(consider_usage_statistics=False) remote_realm_for_deleted_realm = RemoteRealm.objects.get(uuid=deleted_realm_uuid) - self.assertEqual(remote_realm_for_deleted_realm.registration_deactivated, True) + + self.assertEqual(remote_realm_for_deleted_realm.registration_deactivated, False) self.assertEqual(remote_realm_for_deleted_realm.realm_locally_deleted, True) self.assertEqual(analytics_logger.output, ["WARNING:zulip.analytics:Dummy warning"]) diff --git a/zilencer/views.py b/zilencer/views.py index c045568e9c..17728f5ded 100644 --- a/zilencer/views.py +++ b/zilencer/views.py @@ -801,8 +801,11 @@ def update_remote_realm_data_for_server( if not remote_realm.realm_locally_deleted: # Otherwise we already knew about this, so nothing to do. remote_realm.realm_locally_deleted = True - remote_realm.registration_deactivated = True + ## Temporarily disabled deactivating the registration for + ## locally deleted realms pending further work on how to + ## handle test upgrades to 8.0. + # remote_realm.registration_deactivated = True remote_realm_audit_logs.append( RemoteRealmAuditLog( server=server,