mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
support: Use datetime for push notification data in remote support.
This commit is contained in:
committed by
Tim Abbott
parent
6dcd4c4ca6
commit
7a40462aed
@@ -7,7 +7,6 @@ from django.utils.timezone import now as timezone_now
|
||||
|
||||
from 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_datetime
|
||||
from zerver.models import Realm
|
||||
from zerver.models.realm_audit_logs import AuditLogEventType
|
||||
from 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
|
||||
|
||||
|
||||
@dataclass
|
||||
class MobilePushData:
|
||||
total_mobile_users: int
|
||||
push_notification_status: PushNotificationsEnabledStatus
|
||||
push_notification_status: PushNotificationsStatus
|
||||
uncategorized_mobile_users: int | None = None
|
||||
mobile_pushes_forwarded: int | None = None
|
||||
last_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,
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user