@@ -194,7 +194,8 @@ def _set_count_in_view(controller: Any, new_count: int,
194
194
continue
195
195
196
196
msg_type = message ['type' ]
197
- add_to_counts = True
197
+ text_color = None
198
+ unread_count_color = 'unread_count'
198
199
if 'mentioned' in message ['flags' ]:
199
200
unread_counts ['all_mentions' ] += new_count
200
201
all_mentioned .update_count (unread_counts ['all_mentions' ])
@@ -203,23 +204,26 @@ def _set_count_in_view(controller: Any, new_count: int,
203
204
stream_id = message ['stream_id' ]
204
205
msg_topic = message ['subject' ]
205
206
if controller .model .is_muted_stream (stream_id ):
206
- add_to_counts = False # if muted, don't add to eg. all_msg
207
- else :
208
- for stream_button in stream_buttons_log :
209
- if stream_button .stream_id == stream_id :
210
- stream_button .update_count (stream_button .count
211
- + new_count )
212
- break
207
+ controller .model .add_to_counts = False
208
+ # if muted, don't add to eg. all_msg
209
+ text_color = 'muted'
210
+ unread_count_color = 'muted'
211
+ for stream_button in stream_buttons_log :
212
+ if stream_button .stream_id == stream_id :
213
+ stream_button .update_count (stream_button .count
214
+ + new_count , text_color , unread_count_color )
213
215
# FIXME: Update unread_counts['unread_topics']?
214
216
if controller .model .is_muted_topic (stream_id , msg_topic ):
215
- add_to_counts = False
217
+ controller .model .add_to_counts = False
218
+ text_color = 'muted'
219
+ unread_count_color = 'muted'
216
220
if is_open_topic_view and stream_id == toggled_stream_id :
217
221
# If topic_view is open for incoming messages's stream,
218
222
# We update the respective TopicButton count accordingly.
219
223
for topic_button in topic_buttons_log :
220
224
if topic_button .topic_name == msg_topic :
221
225
topic_button .update_count (topic_button .count
222
- + new_count )
226
+ + new_count , text_color , unread_count_color )
223
227
else :
224
228
for user_button in user_buttons_log :
225
229
if user_button .user_id == user_id :
@@ -228,7 +232,7 @@ def _set_count_in_view(controller: Any, new_count: int,
228
232
unread_counts ['all_pms' ] += new_count
229
233
all_pm .update_count (unread_counts ['all_pms' ])
230
234
231
- if add_to_counts :
235
+ if controller . model . add_to_counts :
232
236
unread_counts ['all_msg' ] += new_count
233
237
all_msg .update_count (unread_counts ['all_msg' ])
234
238
0 commit comments