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.
This commit is contained in:
Tim Abbott 2024-01-04 17:43:54 -08:00
parent 41eb6d947c
commit 880133295e
2 changed files with 6 additions and 2 deletions

View File

@ -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"])

View File

@ -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,