push_notification: Improve logged message when apns_context is None.

Earlier, while sending notification if `apns_context=None` - we logged:
"APNs: Dropping a notification because nothing configured. Set
ZULIP_SERVICES_URL (or APNS_CERT_FILE)." which is not accurate for E2EE
case.

For the non-E2EE case it is correct because configuring
ZULIP_SERVICES_URL results in transfering the responsbility to
make API call to APNs to the bouncer. Or they can configure
APNS_CERT_FILE if they want to send directly.

In E2EE case, the `send_e2ee_push_notification_apple` is part of
bouncer so configuring `ZULIP_SERVICES_URL` doesn't help. One needs
to configure either `APNS_TOKEN_KEY_FILE` or `APNS_CERT_FILE`.

Message to log is updated accordingly + severity increased from
DEBUG to ERROR.

Signed-off-by: Prakhar Pratyush <prakhar@zulip.com>
This commit is contained in:
Prakhar Pratyush
2025-11-04 00:38:21 +05:30
committed by Tim Abbott
parent d893496de1
commit 25630f316b
2 changed files with 6 additions and 7 deletions

View File

@@ -40,9 +40,9 @@ def send_e2ee_push_notification_apple(
apns_context = get_apns_context()
if apns_context is None:
logger.debug(
"APNs: Dropping a notification because nothing configured. "
"Set ZULIP_SERVICES_URL (or APNS_CERT_FILE)."
logger.error(
"APNs: Dropping push notifications since "
"neither APNS_TOKEN_KEY_FILE nor APNS_CERT_FILE is set."
)
return SentPushNotificationResult(
successfully_sent_count=successfully_sent_count,