push_notifications: Skip enqueuing notif for users without push devices.

Previously, we enqueued events to "missedmessage_mobile_notifications"
even for users who had no registered push devices.
'handle_push_notification' later used to perform the check & skip
if there were no registered devices.

This commit avoids putting such events into the
"missedmessage_mobile_notifications" queue at all. By doing so,
we reduce unnecessary churn.
This commit is contained in:
Prakhar Pratyush
2025-09-05 21:27:09 +05:30
committed by Tim Abbott
parent aa317ee844
commit 421637ce31
13 changed files with 236 additions and 36 deletions

View File

@@ -1917,6 +1917,23 @@ Output:
realm, licenses, licenses_at_next_renewal, CustomerPlan.BILLING_SCHEDULE_MONTHLY
)
def register_push_device(self, user_profile_id: int) -> None:
PushDevice.objects.create(
user_id=user_profile_id,
push_account_id=10,
bouncer_device_id=1,
token_kind=PushDevice.TokenKind.FCM,
push_public_key="n4WTVqj8KH6u0vScRycR4TqRaHhFeJ0POvMb8LCu8iI=",
)
def register_push_device_token(self, user_profile_id: int) -> None:
PushDeviceToken.objects.create(
user_id=user_profile_id,
kind=PushDeviceToken.APNS,
token="test-token",
ios_app_id="com.zulip.flutter",
)
def create_user_notifications_data_object(
self, *, user_id: int, **kwargs: Any
) -> UserMessageNotificationsData: