diff options
author | ThibG <thib@sitedethib.com> | 2019-09-18 11:27:10 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2019-09-18 11:27:10 +0200 |
commit | 577706987d2e09e598130d37fb9a52cd4a6510ea (patch) | |
tree | 9fb8259f7ee58a079ed5c5826c746da53711a48e /app/javascript/mastodon/reducers/notifications.js | |
parent | 0e6390753d4a93af7e705f7cca5946e232298fc5 (diff) |
Fix “load more” adding older toots/notifications to pending items (#11883)
Diffstat (limited to 'app/javascript/mastodon/reducers/notifications.js')
-rw-r--r-- | app/javascript/mastodon/reducers/notifications.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/javascript/mastodon/reducers/notifications.js b/app/javascript/mastodon/reducers/notifications.js index 811550a8a..45d3a5c51 100644 --- a/app/javascript/mastodon/reducers/notifications.js +++ b/app/javascript/mastodon/reducers/notifications.js @@ -54,7 +54,7 @@ const normalizeNotification = (state, notification, usePendingItems) => { }); }; -const expandNormalizedNotifications = (state, notifications, next, usePendingItems) => { +const expandNormalizedNotifications = (state, notifications, next, isLoadingRecent, usePendingItems) => { let items = ImmutableList(); notifications.forEach((n, i) => { @@ -63,7 +63,7 @@ const expandNormalizedNotifications = (state, notifications, next, usePendingIte return state.withMutations(mutable => { if (!items.isEmpty()) { - usePendingItems = usePendingItems || !mutable.get('top') || !mutable.get('pendingItems').isEmpty(); + usePendingItems = isLoadingRecent && (usePendingItems || !mutable.get('top') || !mutable.get('pendingItems').isEmpty()); mutable.update(usePendingItems ? 'pendingItems' : 'items', list => { const lastIndex = 1 + list.findLastIndex( @@ -119,7 +119,7 @@ export default function notifications(state = initialState, action) { case NOTIFICATIONS_UPDATE: return normalizeNotification(state, action.notification, action.usePendingItems); case NOTIFICATIONS_EXPAND_SUCCESS: - return expandNormalizedNotifications(state, action.notifications, action.next, action.usePendingItems); + return expandNormalizedNotifications(state, action.notifications, action.next, action.isLoadingRecent, action.usePendingItems); case ACCOUNT_BLOCK_SUCCESS: return filterNotifications(state, [action.relationship.id]); case ACCOUNT_MUTE_SUCCESS: |