mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 02:17:19 +00:00
notification_data: Annotate flags with Collection.
Since `flags` here could be iterated through multiple times
(to check for push/email notifiability), we use `Collection`.
Inspired by 871e73ab8f.
The other change here in the `event_queue` code is prep for using
the `UserMessageNotificationsData` class there.
This commit is contained in:
committed by
Tim Abbott
parent
8182632d7e
commit
aeb2ad5f46
@@ -1,11 +1,11 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import List
|
from typing import Collection
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class UserMessageNotificationsData:
|
class UserMessageNotificationsData:
|
||||||
id: int
|
id: int
|
||||||
flags: List[str]
|
flags: Collection[str]
|
||||||
mentioned: bool
|
mentioned: bool
|
||||||
online_push_enabled: bool
|
online_push_enabled: bool
|
||||||
stream_push_notify: bool
|
stream_push_notify: bool
|
||||||
|
|||||||
@@ -948,7 +948,7 @@ def process_message_event(
|
|||||||
|
|
||||||
for user_data in users:
|
for user_data in users:
|
||||||
user_profile_id: int = user_data["id"]
|
user_profile_id: int = user_data["id"]
|
||||||
flags: Iterable[str] = user_data.get("flags", [])
|
flags: Collection[str] = user_data.get("flags", [])
|
||||||
|
|
||||||
# If the recipient was offline and the message was a single or group PM to them
|
# If the recipient was offline and the message was a single or group PM to them
|
||||||
# or they were @-notified potentially notify more immediately
|
# or they were @-notified potentially notify more immediately
|
||||||
|
|||||||
Reference in New Issue
Block a user