forked from treehouse/mastodon
[Glitch] Fix filtered out items being counted as pending items
Port 3db3c10762
to glitch-soc
Signed-off-by: Thibaut Girka <thib@sitedethib.com>
rebase/4.0.0rc2
parent
d76ab55608
commit
734181c3bf
|
@ -19,9 +19,9 @@ const getRegex = createSelector([
|
||||||
return regex;
|
return regex;
|
||||||
});
|
});
|
||||||
|
|
||||||
const makeGetStatusIds = () => createSelector([
|
const makeGetStatusIds = (pending = false) => createSelector([
|
||||||
(state, { type }) => state.getIn(['settings', type], ImmutableMap()),
|
(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'),
|
(state) => state.get('statuses'),
|
||||||
getRegex,
|
getRegex,
|
||||||
], (columnSettings, statusIds, statuses, regex) => {
|
], (columnSettings, statusIds, statuses, regex) => {
|
||||||
|
@ -56,13 +56,14 @@ const makeGetStatusIds = () => createSelector([
|
||||||
|
|
||||||
const makeMapStateToProps = () => {
|
const makeMapStateToProps = () => {
|
||||||
const getStatusIds = makeGetStatusIds();
|
const getStatusIds = makeGetStatusIds();
|
||||||
|
const getPendingStatusIds = makeGetStatusIds(true);
|
||||||
|
|
||||||
const mapStateToProps = (state, { timelineId }) => ({
|
const mapStateToProps = (state, { timelineId }) => ({
|
||||||
statusIds: getStatusIds(state, { type: timelineId }),
|
statusIds: getStatusIds(state, { type: timelineId }),
|
||||||
isLoading: state.getIn(['timelines', timelineId, 'isLoading'], true),
|
isLoading: state.getIn(['timelines', timelineId, 'isLoading'], true),
|
||||||
isPartial: state.getIn(['timelines', timelineId, 'isPartial'], false),
|
isPartial: state.getIn(['timelines', timelineId, 'isPartial'], false),
|
||||||
hasMore: state.getIn(['timelines', timelineId, 'hasMore']),
|
hasMore: state.getIn(['timelines', timelineId, 'hasMore']),
|
||||||
numPending: state.getIn(['timelines', timelineId, 'pendingItems'], ImmutableList()).size,
|
numPending: getPendingStatusIds(state, { type: timelineId }).size,
|
||||||
});
|
});
|
||||||
|
|
||||||
return mapStateToProps;
|
return mapStateToProps;
|
||||||
|
|
Loading…
Reference in New Issue