Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

zilencer: Update comments on remotepushdevice.

Tim Abbott71e8fcbb3a26
diff --git a/zilencer/models.py b/zilencer/models.py
index 1465617b0a2..ac142dbb06d 100644
--- a/zilencer/models.py
+++ b/zilencer/models.py
@@ -95,7 +95,12 @@ class RemoteZulipServer(models.Model):
class RemotePushDeviceToken(AbstractPushDeviceToken):
- """Like PushDeviceToken, but for a device connected to a remote server."""
+ """Class for storing legacy non-E2EE mobile push
+ tokens. Deprecated in favor of RemotePushDevice, which is designed
+ for E2EE mobile notifications.
+
+ Like PushDeviceToken, but for a device connected to a remote server.
+ """
server = models.ForeignKey(RemoteZulipServer, on_delete=models.CASCADE)
# The user id on the remote server for this device
@@ -590,19 +595,24 @@ def has_stale_audit_log(server: RemoteZulipServer) -> bool:
class RemotePushDevice(models.Model):
- """Each row corresponds to an account on an install of the app
+ """Core bouncer server table storing registrations to receive
+ mobile push notifications via the bouncer server.
+
+ Each row corresponds to an account on an install of the app
registered to receive mobile push notifications.
"""
+ # Unique identifier assigned by the bouncer for this registration.
device_id = models.BigAutoField(primary_key=True)
- # Set to null for self-hosters. `remote_realm` is set instead.
+ # Realm that the account is associated with. Both Cloud and
+ # self-hosted are supported; exactly one of these will be null.
realm = models.ForeignKey(Realm, on_delete=models.CASCADE, null=True)
-
- # Set to null for zulip cloud. `realm` is set instead.
remote_realm = models.ForeignKey(RemoteRealm, on_delete=models.CASCADE, null=True)
- # A token that uniquely identifies the app instance.
+ # The token that uniquely identifies the app instance to the
+ # FCM/APNs servers. There will be duplicates in this table when a
+ # device is logged into multiple Zulip realms.
#
# FCM and APNs don't specify a maximum token length, so we only enforce
# that they're at most the maximum FCM / APNs payload size of 4096 bytes.
@@ -614,12 +624,17 @@ class RemotePushDevice(models.Model):
token_kind = models.PositiveSmallIntegerField(choices=TokenKind.choices)
- # ID to identify an account within an install of the app.
+ # 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
+ # token is still valid.
expired_time = models.DateTimeField(null=True)
- # [optional] Contains the app id of the device if it is an iOS device
+ # Contains the app id of the device if and only if token_kind is APNs.
ios_app_id = models.TextField(null=True)
class Meta: