@@ -2352,12 +2352,13 @@ def maybe_refresh_pm_unread_count(now: Time.now)
23522352
23532353 def refresh_notification_unread_count
23542354 data = with_errors { @client . notification_totals }
2355- return false unless data . is_a? ( Hash )
2355+ return { notification : false , pm : false } unless data . is_a? ( Hash )
23562356
23572357 count = data [ "unread_notifications" ] . to_i
23582358 @notification_unread_count = [ count , 0 ] . max
23592359 @live_updates &.set_unread_notification_count ( @notification_unread_count )
23602360
2361+ pm_refreshed = false
23612362 pm_count =
23622363 if data . key? ( "unread_personal_messages" )
23632364 data [ "unread_personal_messages" ] . to_i
@@ -2367,8 +2368,9 @@ def refresh_notification_unread_count
23672368 unless pm_count . nil?
23682369 @pm_unread_count = [ pm_count , 0 ] . max
23692370 @live_updates &.set_pm_unread_count ( @pm_unread_count )
2371+ pm_refreshed = true
23702372 end
2371- true
2373+ { notification : true , pm : pm_refreshed }
23722374 end
23732375
23742376 def maybe_refresh_notification_unread_count ( now : Time . now )
@@ -2379,7 +2381,7 @@ def maybe_refresh_notification_unread_count(now: Time.now)
23792381 return if @last_notification_unread_refresh_at && ( now - @last_notification_unread_refresh_at ) < @notification_unread_refresh_interval
23802382
23812383 refreshed = refresh_notification_unread_count
2382- @last_notification_unread_refresh_at = now if refreshed
2384+ @last_notification_unread_refresh_at = now if refreshed [ :notification ]
23832385 end
23842386
23852387 def maybe_refresh_status_counts ( now : Time . now )
@@ -2415,8 +2417,8 @@ def consume_topic_list_refresh_request(filter:, top_period:)
24152417
24162418 def seed_status_counts_from_server ( now : Time . now )
24172419 notification_refreshed = refresh_notification_unread_count
2418- pm_refreshed = @pm_unread_count . to_i > 0 ? true : refresh_pm_unread_count
2419- @last_notification_unread_refresh_at = now if notification_refreshed
2420+ pm_refreshed = notification_refreshed [ :pm ] || refresh_pm_unread_count
2421+ @last_notification_unread_refresh_at = now if notification_refreshed [ :notification ]
24202422 @last_pm_unread_refresh_at = now if pm_refreshed
24212423 end
24222424
0 commit comments