Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
push_notifications: Convert UserPushIdentityCompat to dataclass.
Anders Kaseorg2747127e6cfd
diff --git a/zerver/lib/push_notifications.py b/zerver/lib/push_notifications.pyindex 2ac552a5e00..fed01da3525 100644--- a/zerver/lib/push_notifications.py+++ b/zerver/lib/push_notifications.py@@ -95,6 +95,7 @@ def get_message_stream_name_from_database(message: Message) -> str:return Stream.objects.get(id=stream_id).name+@dataclassclass UserPushIdentityCompat:"""Compatibility class for supporting the transition from remote serverssending their UserProfile ids to the bouncer to sending UserProfile uuids instead.@@ -104,10 +105,11 @@ class UserPushIdentityCompat:may be represented either by an id or uuid."""- def __init__(self, user_id: int | None = None, user_uuid: str | None = None) -> None:- assert user_id is not None or user_uuid is not None- self.user_id = user_id- self.user_uuid = user_uuid+ user_id: int | None = None+ user_uuid: str | None = None++ def __post_init__(self) -> None:+ assert self.user_id is not None or self.user_uuid is not Nonedef filter_q(self) -> Q:"""@@ -136,12 +138,6 @@ class UserPushIdentityCompat:return result- @override- def __eq__(self, other: object) -> bool:- if isinstance(other, UserPushIdentityCompat):- return self.user_id == other.user_id and self.user_uuid == other.user_uuid- return False-## Sending to APNs, for iOS