diff options
author | Thibaut Girka <thib@sitedethib.com> | 2020-10-08 21:45:50 +0200 |
---|---|---|
committer | ThibG <thib@sitedethib.com> | 2020-10-08 22:44:30 +0200 |
commit | cd861c051ce5500df49d2fc41b2a6084faa34620 (patch) | |
tree | 1c214f04b663b4fe0cd0103c76d6eb83072d36c7 /app | |
parent | b5edf30160eab3776e44b34325a4ea00d9f71dc5 (diff) |
Fix issue checking for last unread notification when there are gaps
Diffstat (limited to 'app')
-rw-r--r-- | app/javascript/flavours/glitch/reducers/notifications.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/reducers/notifications.js b/app/javascript/flavours/glitch/reducers/notifications.js index 474ca3012..e136369ae 100644 --- a/app/javascript/flavours/glitch/reducers/notifications.js +++ b/app/javascript/flavours/glitch/reducers/notifications.js @@ -206,7 +206,8 @@ const shouldCountUnreadNotifications = (state) => { 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 && isOnTop && isMounted && lastItemReached); }; |