api_docs: Fix 500 error on /api/register-remote-push-device.

`settings.ZULIP_SERVICES_URL` is used to construct curl
example for `/api/register-remote-push-device`.

On zulip cloud `settings.ZULIP_SERVICES_URL=None`, it resulted
in 500 error on visiting that page.

This commit fixes the bug by using "https://push.zulipchat.com"
as the default value if `settings.ZULIP_SERVICES_URL=None`.

The doc already mentions that the endpoint is meant to be used
by self-hosted servers, so the default value makes sense if
ZULIP_SERVICES_URL=None.
This commit is contained in:
Prakhar Pratyush
2025-09-04 17:45:12 +05:30
committed by Tim Abbott
parent 39b560e611
commit 271aba001c
2 changed files with 2 additions and 2 deletions

View File

@@ -50,7 +50,7 @@ def add_api_url_context(
context.update(zulip_default_context(request))
if is_zilencer_endpoint:
context["api_url"] = settings.ZULIP_SERVICES_URL + "/api"
context["api_url"] = (settings.ZULIP_SERVICES_URL or "https://push.zulipchat.com") + "/api"
return
subdomain = get_subdomain(request)

View File

@@ -231,7 +231,7 @@ PASSWORD_MIN_GUESSES = 10000
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2 # 2 weeks
ZULIP_SERVICES_URL = "https://push.zulipchat.com"
ZULIP_SERVICES_URL: str | None = "https://push.zulipchat.com"
ZULIP_SERVICE_PUSH_NOTIFICATIONS = False
# For this setting, we need to have None as the default value, so