@@ -135,10 +135,10 @@ class Index(TypedDict):
135135
136136class UnreadCounts (TypedDict ):
137137 all_msg : int
138- all_pms : int
138+ all_dms : int
139139 all_mentions : int
140140 unread_topics : Dict [Tuple [int , str ], int ] # stream_id, topic
141- unread_pms : Dict [int , int ] # sender_id
141+ unread_dms : Dict [int , int ] # sender_id
142142 unread_huddles : Dict [FrozenSet [int ], int ] # Group dms
143143 streams : Dict [int , int ] # stream_id
144144
@@ -209,7 +209,7 @@ def update_unreads(unreads: Dict[KeyT, int], key: KeyT) -> None:
209209 # self-dm has only one display_recipient
210210 # 1-1 dms have 2 display_recipient
211211 elif len (message ["display_recipient" ]) <= 2 :
212- update_unreads (unread_counts ["unread_pms " ], message ["sender_id" ])
212+ update_unreads (unread_counts ["unread_dms " ], message ["sender_id" ])
213213 else : # If it's a group dm
214214 update_unreads (
215215 unread_counts ["unread_huddles" ],
@@ -227,7 +227,7 @@ def _set_count_in_view(
227227) -> None :
228228 """
229229 This function for the most part contains the logic for setting the
230- count in the UI buttons. The later buttons (all_msg, all_pms )
230+ count in the UI buttons. The later buttons (all_msg, all_dms )
231231 additionally set the current count in the model and make use of the
232232 same in the UI.
233233 """
@@ -238,7 +238,7 @@ def _set_count_in_view(
238238 toggled_stream_id = controller .view .topic_w .stream_button .stream_id
239239 user_buttons_list = controller .view .user_w .users_btn_list
240240 all_msg = controller .view .home_button
241- all_pm = controller .view .pm_button
241+ all_dm = controller .view .pm_button
242242 all_mentioned = controller .view .mentioned_button
243243 for message in changed_messages :
244244 user_id = message ["sender_id" ]
@@ -277,8 +277,8 @@ def _set_count_in_view(
277277 if user_button .user_id == user_id :
278278 user_button .update_count (user_button .count + new_count )
279279 break
280- unread_counts ["all_pms " ] += new_count
281- all_pm .update_count (unread_counts ["all_pms " ])
280+ unread_counts ["all_dms " ] += new_count
281+ all_dm .update_count (unread_counts ["all_dms " ])
282282
283283 if add_to_counts :
284284 unread_counts ["all_msg" ] += new_count
@@ -487,10 +487,10 @@ def classify_unread_counts(model: Any) -> UnreadCounts:
487487
488488 unread_counts = UnreadCounts (
489489 all_msg = 0 ,
490- all_pms = 0 ,
490+ all_dms = 0 ,
491491 all_mentions = 0 ,
492492 unread_topics = dict (),
493- unread_pms = dict (),
493+ unread_dms = dict (),
494494 unread_huddles = dict (),
495495 streams = defaultdict (int ),
496496 )
@@ -500,9 +500,9 @@ def classify_unread_counts(model: Any) -> UnreadCounts:
500500
501501 for dm in unread_msg_counts ["pms" ]:
502502 count = len (dm ["unread_message_ids" ])
503- unread_counts ["unread_pms " ][dm ["sender_id" ]] = count
503+ unread_counts ["unread_dms " ][dm ["sender_id" ]] = count
504504 unread_counts ["all_msg" ] += count
505- unread_counts ["all_pms " ] += count
505+ unread_counts ["all_dms " ] += count
506506
507507 for stream in unread_msg_counts ["streams" ]:
508508 count = len (stream ["unread_message_ids" ])
@@ -522,13 +522,13 @@ def classify_unread_counts(model: Any) -> UnreadCounts:
522522 unread_counts ["all_msg" ] += count
523523
524524 # store unread count of group dms in `unread_huddles`
525- for group_pm in unread_msg_counts ["huddles" ]:
526- count = len (group_pm ["unread_message_ids" ])
527- user_ids = group_pm ["user_ids_string" ].split ("," )
525+ for group in unread_msg_counts ["huddles" ]:
526+ count = len (group ["unread_message_ids" ])
527+ user_ids = group ["user_ids_string" ].split ("," )
528528 user_ids = frozenset (map (int , user_ids ))
529529 unread_counts ["unread_huddles" ][user_ids ] = count
530530 unread_counts ["all_msg" ] += count
531- unread_counts ["all_pms " ] += count
531+ unread_counts ["all_dms " ] += count
532532
533533 return unread_counts
534534
0 commit comments