Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
support: Use datetime for push notification data in remote support.
Lauryn Menard7a40462aed7e
diff --git a/corporate/lib/support.py b/corporate/lib/support.pyindex c013bc88871..34fef3756fe 100644--- a/corporate/lib/support.py+++ b/corporate/lib/support.py@@ -7,7 +7,6 @@ from django.utils.timezone import now as timezone_nowfrom corporate.lib.stripe import (BillingSession,- PushNotificationsEnabledStatus,RealmBillingSession,RemoteRealmBillingSession,RemoteServerBillingSession,@@ -25,6 +24,7 @@ from corporate.models import (ZulipSponsorshipRequest,get_current_plan_by_customer,)+from zerver.lib.timestamp import timestamp_to_datetimefrom zerver.models import Realmfrom zerver.models.realm_audit_logs import AuditLogEventTypefrom zerver.models.realms import get_org_type_display_name@@ -91,10 +91,17 @@ class PlanData:estimated_next_plan_revenue: int | None = None+@dataclass+class PushNotificationsStatus:+ can_push: bool+ expected_end: datetime | None+ message: str++@dataclassclass MobilePushData:total_mobile_users: int- push_notification_status: PushNotificationsEnabledStatus+ push_notification_status: PushNotificationsStatusuncategorized_mobile_users: int | None = Nonemobile_pushes_forwarded: int | None = Nonelast_mobile_push_sent: str = ""@@ -350,9 +357,16 @@ def get_mobile_push_data(remote_entity: RemoteZulipServer | RemoteRealm) -> Mobi).strftime("%Y-%m-%d")else:push_forwarded_interval_start = "None"- push_notification_status = get_push_status_for_remote_request(+ push_status = get_push_status_for_remote_request(remote_server=remote_entity, remote_realm=None)+ push_notification_status = PushNotificationsStatus(+ can_push=push_status.can_push,+ expected_end=timestamp_to_datetime(push_status.expected_end_timestamp)+ if push_status.expected_end_timestamp+ else None,+ message=push_status.message,+ )return MobilePushData(total_mobile_users=total_users,push_notification_status=push_notification_status,@@ -386,8 +400,13 @@ def get_mobile_push_data(remote_entity: RemoteZulipServer | RemoteRealm) -> Mobi).strftime("%Y-%m-%d")else:push_forwarded_interval_start = "None"- push_notification_status = get_push_status_for_remote_request(- remote_entity.server, remote_entity+ push_status = get_push_status_for_remote_request(remote_entity.server, remote_entity)+ push_notification_status = PushNotificationsStatus(+ can_push=push_status.can_push,+ expected_end=timestamp_to_datetime(push_status.expected_end_timestamp)+ if push_status.expected_end_timestamp+ else None,+ message=push_status.message,)return MobilePushData(total_mobile_users=mobile_users,diff --git a/templates/corporate/support/push_status_details.html b/templates/corporate/support/push_status_details.htmlindex e0df02be48d..dcb67e4b942 100644--- a/templates/corporate/support/push_status_details.html+++ b/templates/corporate/support/push_status_details.html@@ -1,6 +1,6 @@<div class="push-notification-status"><p class="support-section-header">📶 Push notification status:</p><b>Can push</b>: {{ status.can_push }}<br />- <b>Expected end</b>: {{ format_optional_datetime(status.expected_end_timestamp, True) }}<br />+ <b>Expected end</b>: {{ format_optional_datetime(status.expected_end, True) }}<br /><b>Message</b>: {{ status.message }}<br /></div>