]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Fix unread notification count when polling
authorClaire <claire.github-309c@sitedethib.com>
Wed, 19 May 2021 21:51:05 +0000 (23:51 +0200)
committerClaire <claire.github-309c@sitedethib.com>
Sat, 22 May 2021 11:20:07 +0000 (13:20 +0200)
Port 92f1d739b554b6d5496013fb50196a14434943e2 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
app/javascript/flavours/glitch/reducers/notifications.js

index b4c5ef71a073be8ff609bb04a7fdbfad3f808619..859a8b3a1a9e5d2378fb4c3ba3c5a16e8fda474c 100644 (file)
@@ -112,7 +112,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) {