mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
zerver: Add PushDevice
model.
This commit adds a `PushDevice` model where each row corresponds to an account on an install of the app that has attempted to register with the bouncer to receive mobile push notifications. This is the core server table storing registrations that are potentially registered with the mobile push notifications bouncer service.
This commit is contained in:
committed by
Tim Abbott
parent
3c6a3b0d77
commit
6a4b06b6f4
@@ -11,7 +11,13 @@ from typing_extensions import override
|
||||
from analytics.models import BaseCount
|
||||
from zerver.lib.rate_limiter import RateLimitedObject
|
||||
from zerver.lib.rate_limiter import rules as rate_limiter_rules
|
||||
from zerver.models import AbstractPushDeviceToken, AbstractRealmAuditLog, Realm, UserProfile
|
||||
from zerver.models import (
|
||||
AbstractPushDevice,
|
||||
AbstractPushDeviceToken,
|
||||
AbstractRealmAuditLog,
|
||||
Realm,
|
||||
UserProfile,
|
||||
)
|
||||
from zerver.models.realm_audit_logs import AuditLogEventType
|
||||
|
||||
|
||||
@@ -594,7 +600,7 @@ def has_stale_audit_log(server: RemoteZulipServer) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
class RemotePushDevice(models.Model):
|
||||
class RemotePushDevice(AbstractPushDevice):
|
||||
"""Core bouncer server table storing registrations to receive
|
||||
mobile push notifications via the bouncer server.
|
||||
|
||||
@@ -618,16 +624,6 @@ class RemotePushDevice(models.Model):
|
||||
# that they're at most the maximum FCM / APNs payload size of 4096 bytes.
|
||||
token = models.CharField(max_length=4096)
|
||||
|
||||
class TokenKind(models.TextChoices):
|
||||
APNS = "apns", "APNs"
|
||||
FCM = "fcm", "FCM"
|
||||
|
||||
token_kind = models.CharField(max_length=4, choices=TokenKind.choices)
|
||||
|
||||
# 64-bit random integer ID generated by the client; will only be
|
||||
# guaranteed to be unique within the client's own table of accounts.
|
||||
push_account_id = models.BigIntegerField()
|
||||
|
||||
# If the token is expired, the date when the bouncer learned it
|
||||
# was expired via an error from the FCM/APNs server. Used to
|
||||
# support delayed deletion. Null if the bouncer believes this
|
||||
|
Reference in New Issue
Block a user