diff --git a/zerver/lib/push_notifications.py b/zerver/lib/push_notifications.py index dc03656968..89119d109e 100644 --- a/zerver/lib/push_notifications.py +++ b/zerver/lib/push_notifications.py @@ -1534,9 +1534,8 @@ class PushNotificationsDisallowedByBouncerError(Exception): class HostnameAlreadyInUseBouncerError(JsonableError): code = ErrorCode.HOSTNAME_ALREADY_IN_USE_BOUNCER_ERROR - docs_url = "https://zulip.readthedocs.io/en/latest/production/mobile-push-notifications.html#moving-your-registration-to-a-new-server" - data_fields = ["hostname", "docs_url"] + data_fields = ["hostname"] def __init__(self, hostname: str) -> None: self.hostname: str = hostname diff --git a/zerver/management/commands/register_server.py b/zerver/management/commands/register_server.py index c764b08290..9bbcc611cc 100644 --- a/zerver/management/commands/register_server.py +++ b/zerver/management/commands/register_server.py @@ -237,7 +237,6 @@ that registration and saving the updated secret in "code" in content_dict and content_dict["code"] == "HOSTNAME_ALREADY_IN_USE_BOUNCER_ERROR" ): - docs_url = content_dict["docs_url"] print( "--------------------------------\n" "The hostname is already in use by another server. If you control the hostname \n" @@ -247,7 +246,7 @@ that registration and saving the updated secret in "\n" "For more information, see: \n" "\n" - f"{docs_url}" + "" ) raise CommandError diff --git a/zerver/tests/test_home.py b/zerver/tests/test_home.py index 0342e89325..9cfe4d0cc1 100644 --- a/zerver/tests/test_home.py +++ b/zerver/tests/test_home.py @@ -1515,5 +1515,12 @@ class TestDocRedirectView(ZulipTestCase): "https://zulip.readthedocs.io/en/latest/production/mobile-push-notifications.html#why-a-push-notification-service-is-necessary", ) + result = self.client_get("/doc-permalinks/registration-transfer") + self.assertEqual(result.status_code, 302) + self.assertEqual( + result["Location"], + "https://zulip.readthedocs.io/en/latest/production/mobile-push-notifications.html#moving-your-registration-to-a-new-server", + ) + result = self.client_get("/doc-permalinks/invalid-doc-id") self.assertEqual(result.status_code, 404) diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.py index 2409b63633..b347bbfad1 100644 --- a/zerver/tests/test_push_notifications.py +++ b/zerver/tests/test_push_notifications.py @@ -48,7 +48,6 @@ from zerver.lib.exceptions import JsonableError from zerver.lib.push_notifications import ( APNsContext, DeviceToken, - HostnameAlreadyInUseBouncerError, InvalidRemotePushDeviceTokenError, UserPushIdentityCompat, b64_to_hex, @@ -5386,7 +5385,6 @@ class PushBouncerSignupTest(ZulipTestCase): result = self.client_post("/api/v1/remotes/server/register", request) self.assert_json_error(result, "A server with hostname example.com already exists") self.assertEqual(result.json()["code"], "HOSTNAME_ALREADY_IN_USE_BOUNCER_ERROR") - self.assertEqual(result.json()["docs_url"], HostnameAlreadyInUseBouncerError.docs_url) def test_register_contact_email_validation_rules(self) -> None: zulip_org_id = str(uuid.uuid4()) diff --git a/zerver/views/home.py b/zerver/views/home.py index 795e7e76a0..0d01fcdf2e 100644 --- a/zerver/views/home.py +++ b/zerver/views/home.py @@ -273,6 +273,7 @@ def doc_permalinks_view(request: HttpRequest, doc_id: str) -> HttpResponse: "usage-statistics": "https://zulip.readthedocs.io/en/latest/production/mobile-push-notifications.html#uploading-usage-statistics", "basic-metadata": "https://zulip.readthedocs.io/en/latest/production/mobile-push-notifications.html#uploading-basic-metadata", "why-service": "https://zulip.readthedocs.io/en/latest/production/mobile-push-notifications.html#why-a-push-notification-service-is-necessary", + "registration-transfer": "https://zulip.readthedocs.io/en/latest/production/mobile-push-notifications.html#moving-your-registration-to-a-new-server", } redirect_url = DOC_PERMALINK_MAP.get(doc_id)