Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
zilencer: Improve "hostname already exists" error in registration.
Mateusz Mandera685e49d34d27
diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.pyindex d6e2ad97be8..72665171c75 100644--- a/zerver/tests/test_push_notifications.py+++ b/zerver/tests/test_push_notifications.py@@ -5359,7 +5359,13 @@ class PushBouncerSignupTest(ZulipTestCase):contact_email="[email protected]",)result = self.client_post("/api/v1/remotes/server/register", request)- self.assert_json_error(result, "A server with hostname example.com already exists")+ self.assert_json_error(+ result,+ "A server with hostname example.com already exists. "+ "If you control the hostname "+ "and want to transfer the registration to this server, you can run manage.py register_server "+ "with the --registration-takeover flag.",+ )def test_register_contact_email_validation_rules(self) -> None:zulip_org_id = str(uuid.uuid4())diff --git a/zilencer/views.py b/zilencer/views.pyindex 01890029394..d822b204dce 100644--- a/zilencer/views.py+++ b/zilencer/views.py@@ -260,7 +260,11 @@ def register_remote_server(if remote_server is None and RemoteZulipServer.objects.filter(hostname=hostname).exists():raise JsonableError(- _("A server with hostname {hostname} already exists").format(hostname=hostname)+ _(+ "A server with hostname {hostname} already exists. If you control the hostname "+ "and want to transfer the registration to this server, you can run manage.py register_server "+ "with the --registration-takeover flag."+ ).format(hostname=hostname))with transaction.atomic(durable=True):