about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-10-09 17:12:52 +0200
committerGitHub <noreply@github.com>2020-10-09 17:12:52 +0200
commitdc52a778e111a67a5275dd4afecf3991e279e005 (patch)
treead5459d98303d279fa355fb52fdc00b5a6ac00cd /app/javascript
parentdac3e362fd5c3d1be9e5d89149049a7eb2c6bbc4 (diff)
Fix issue checking for last unread notification when there are gaps (#14960)
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/mastodon/reducers/notifications.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/javascript/mastodon/reducers/notifications.js b/app/javascript/mastodon/reducers/notifications.js
index 98c91ebb2..216876134 100644
--- a/app/javascript/mastodon/reducers/notifications.js
+++ b/app/javascript/mastodon/reducers/notifications.js
@@ -172,7 +172,8 @@ const shouldCountUnreadNotifications = (state, ignoreScroll = false) => {
   const isOnTop        = state.get('top');
   const isMounted      = state.get('mounted') > 0;
   const lastReadId     = state.get('lastReadId');
-  const lastItemReached = !state.get('hasMore') || lastReadId === '0' || (!state.get('items').isEmpty() && compareId(state.get('items').last().get('id'), lastReadId) <= 0);
+  const lastItem       = state.get('items').findLast(item => item !== null);
+  const lastItemReached = !state.get('hasMore') || lastReadId === '0' || (lastItem && compareId(lastItem.get('id'), lastReadId) <= 0);
 
   return !(isTabVisible && (ignoreScroll || isOnTop) && isMounted && lastItemReached);
 };