push_notifs: Make appid required on add_apns_device_token.

We're going to need to use this information, so we shouldn't just
assume a value; the client should tell us the actual value.

Conveniently, the Zulip mobile app does already pass this parameter
and has since forever.  So we can just start requiring it, with no
compatibility constraint.
This commit is contained in:
Greg Price
2023-11-06 11:05:30 -08:00
committed by Tim Abbott
parent 5d0d35d3f5
commit fb3af7fbcb
4 changed files with 19 additions and 3 deletions

View File

@@ -1,6 +1,5 @@
from typing import Optional
from django.conf import settings
from django.http import HttpRequest, HttpResponse
from django.utils.translation import gettext as _
@@ -35,7 +34,7 @@ def add_apns_device_token(
request: HttpRequest,
user_profile: UserProfile,
token: str = REQ(),
appid: str = REQ(default=settings.ZULIP_IOS_APP_ID),
appid: str = REQ(),
) -> HttpResponse:
validate_token(token, PushDeviceToken.APNS)
add_push_device_token(user_profile, token, PushDeviceToken.APNS, ios_app_id=appid)