mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +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 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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user