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:
Abhijeet Prasad Bodas
2021-06-21 18:55:47 +05:30
committed by Tim Abbott
parent 8182632d7e
commit aeb2ad5f46
2 changed files with 3 additions and 3 deletions

View File

@@ -1,11 +1,11 @@
from dataclasses import dataclass
from typing import List
from typing import Collection
@dataclass
class UserMessageNotificationsData:
id: int
flags: List[str]
flags: Collection[str]
mentioned: bool
online_push_enabled: bool
stream_push_notify: bool

View File

@@ -948,7 +948,7 @@ def process_message_event(
for user_data in users:
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
# or they were @-notified potentially notify more immediately