about summary refs log tree commit diff
path: root/app/javascript/mastodon/reducers/notifications.js
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-05-19 23:51:05 +0200
committerGitHub <noreply@github.com>2021-05-19 23:51:05 +0200
commit92f1d739b554b6d5496013fb50196a14434943e2 (patch)
tree176dfd15d9cff8c8f445239fe0d8c8b8b37d7d2c /app/javascript/mastodon/reducers/notifications.js
parent689974b1ed081c238560d6b368609acc50dc7336 (diff)
Fix unread notification count when polling (#16272)
* Fix unread notification count when polling

Fixes #16236

* Immediately fetch markers to avoid incorrect unread notification count
Diffstat (limited to 'app/javascript/mastodon/reducers/notifications.js')
-rw-r--r--app/javascript/mastodon/reducers/notifications.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/javascript/mastodon/reducers/notifications.js b/app/javascript/mastodon/reducers/notifications.js
index 1d4874717..b587b6d0f 100644
--- a/app/javascript/mastodon/reducers/notifications.js
+++ b/app/javascript/mastodon/reducers/notifications.js
@@ -106,7 +106,7 @@ const expandNormalizedNotifications = (state, notifications, next, isLoadingRece
     }
 
     if (shouldCountUnreadNotifications(state)) {
-      mutable.update('unread', unread => unread + items.count(item => compareId(item.get('id'), lastReadId) > 0));
+      mutable.set('unread', mutable.get('pendingItems').count(item => item !== null) + mutable.get('items').count(item => item && compareId(item.get('id'), lastReadId) > 0));
     } else {
       const mostRecent = items.find(item => item !== null);
       if (mostRecent && compareId(lastReadId, mostRecent.get('id')) < 0) {