push_notifications: Adjust APNs tokens to be case-insensitive in the database.

APNs apparently treats its tokens case-insensitively; FCM does not.
Adjust the `unique_together` to instead be separate partial
constraints, keyed on the `kind` of the PushDeviceToken.
This commit is contained in:
Alex Vandiver
2025-07-02 04:47:37 +00:00
committed by Tim Abbott
parent 63f6a97f0c
commit 2f4dd72076
8 changed files with 511 additions and 37 deletions

View File

@@ -2757,7 +2757,7 @@ class PushNotificationTestCase(BouncerTestCase):
apns_context.loop.close()
def setup_apns_tokens(self) -> None:
self.tokens = [("aaaa", "org.zulip.Zulip"), ("bbbb", "com.zulip.flutter")]
self.tokens = [("aAAa", "org.zulip.Zulip"), ("bBBb", "com.zulip.flutter")]
for token, appid in self.tokens:
PushDeviceToken.objects.create(
kind=PushDeviceToken.APNS,
@@ -2767,8 +2767,8 @@ class PushNotificationTestCase(BouncerTestCase):
)
self.remote_tokens = [
("cccc", "dddd", "org.zulip.Zulip"),
("eeee", "ffff", "com.zulip.flutter"),
("cCCc", "dDDd", "org.zulip.Zulip"),
("eEEe", "fFFf", "com.zulip.flutter"),
]
for id_token, uuid_token, appid in self.remote_tokens:
# We want to set up both types of RemotePushDeviceToken here: