mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
docs: Remove HostnameAlreadyInUseBouncerError.docs_url.
Now that we introduced an URL for serving permalinks redirecting to docs in #33444, the docs_url mechanism is no longer needed, as we can have a URL that's safe to hard-code in register_server.py. The HostnameAlreadyInUseBouncerError.docs_url has been merged in main briefly enough, that this should be safe to remove.
This commit is contained in:
committed by
Tim Abbott
parent
0a45a289f2
commit
a8fbf6d5d5
@@ -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
|
||||
|
@@ -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}"
|
||||
"<https://zulip.com/doc-permalinks/registration-transfer>"
|
||||
)
|
||||
raise CommandError
|
||||
|
||||
|
@@ -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)
|
||||
|
@@ -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())
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user