zilencer: Improve "hostname already exists" error in registration.

Users most likely to run into this will be the ones who are moving to a
new server, but keeping their original domain and thus just need to
transfer the registration.
This commit is contained in:
Mateusz Mandera
2025-01-12 15:17:49 +08:00
committed by Tim Abbott
parent 4e22a79e6a
commit 685e49d34d
2 changed files with 12 additions and 2 deletions

View File

@@ -5359,7 +5359,13 @@ class PushBouncerSignupTest(ZulipTestCase):
contact_email="server-admin@zulip.com",
)
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())

View File

@@ -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):