Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
push_notifications events: Use DeviceUpdateEvent pydantic type.
Evy Kassirer0ed38178214a
diff --git a/zerver/actions/push_notifications.py b/zerver/actions/push_notifications.pyindex 50a5128a351..e19bdbb722e 100644--- a/zerver/actions/push_notifications.py+++ b/zerver/actions/push_notifications.py@@ -1,5 +1,6 @@from django.utils.timezone import now as timezone_now+from zerver.lib.event_types import DeviceUpdateEventfrom zerver.lib.timestamp import datetime_to_timestampfrom zerver.models import UserProfilefrom zerver.models.devices import Device@@ -34,9 +35,7 @@ def do_register_push_device(])- event = dict(- type="device",- op="update",+ event = DeviceUpdateEvent(device_id=device.id,push_key_id=device.push_key_id,pending_push_token_id=token_id_base64,@@ -60,12 +59,7 @@ def do_rotate_push_key(device.push_key_id = push_key_iddevice.save(update_fields=["push_key", "push_key_id"])- event = dict(- type="device",- op="update",- device_id=device.id,- push_key_id=device.push_key_id,- )+ event = DeviceUpdateEvent(device_id=device.id, push_key_id=device.push_key_id)send_event_on_commit(user_profile.realm, event, [user_profile.id])@@ -83,9 +77,7 @@ def do_rotate_token("push_registration_error_code",])- event = dict(- type="device",- op="update",+ event = DeviceUpdateEvent(device_id=device.id,pending_push_token_id=token_id_base64,push_token_last_updated_timestamp=datetime_to_timestamp(token_updated_at),