From 24bbe9422413915d73d681907f8a5c43e40e9143 Mon Sep 17 00:00:00 2001 From: ThibG Date: Mon, 4 Nov 2019 13:02:16 +0100 Subject: [PATCH] [Glitch] Fix filtered out items being counted as pending items Port 572d9863ab0090889dc8805c3e8099fe40ad8710 to glitch-soc Signed-off-by: Thibaut Girka --- .../glitch/features/ui/containers/status_list_container.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/javascript/flavours/glitch/features/ui/containers/status_list_container.js b/app/javascript/flavours/glitch/features/ui/containers/status_list_container.js index 4ca8535638..c01d0e5bce 100644 --- a/app/javascript/flavours/glitch/features/ui/containers/status_list_container.js +++ b/app/javascript/flavours/glitch/features/ui/containers/status_list_container.js @@ -19,9 +19,9 @@ const getRegex = createSelector([ return regex; }); -const makeGetStatusIds = () => createSelector([ +const makeGetStatusIds = (pending = false) => createSelector([ (state, { type }) => state.getIn(['settings', type], ImmutableMap()), - (state, { type }) => state.getIn(['timelines', type, 'items'], ImmutableList()), + (state, { type }) => state.getIn(['timelines', type, pending ? 'pendingItems' : 'items'], ImmutableList()), (state) => state.get('statuses'), getRegex, ], (columnSettings, statusIds, statuses, regex) => { @@ -56,13 +56,14 @@ const makeGetStatusIds = () => createSelector([ const makeMapStateToProps = () => { const getStatusIds = makeGetStatusIds(); + const getPendingStatusIds = makeGetStatusIds(true); const mapStateToProps = (state, { timelineId }) => ({ statusIds: getStatusIds(state, { type: timelineId }), isLoading: state.getIn(['timelines', timelineId, 'isLoading'], true), isPartial: state.getIn(['timelines', timelineId, 'isPartial'], false), hasMore: state.getIn(['timelines', timelineId, 'hasMore']), - numPending: state.getIn(['timelines', timelineId, 'pendingItems'], ImmutableList()).size, + numPending: getPendingStatusIds(state, { type: timelineId }).size, }); return mapStateToProps;