diff --git a/src/shared/actions/challenge-listing/index.js b/src/shared/actions/challenge-listing/index.js index 5ed1f18c1d..b82ceb5d41 100644 --- a/src/shared/actions/challenge-listing/index.js +++ b/src/shared/actions/challenge-listing/index.js @@ -206,9 +206,12 @@ function getRestActiveChallengesInit(uuid) { * @param {String} uuid progress id * @param {String} tokenV3 token v3 */ -function getRestActiveChallengesDone(uuid, tokenV3) { - const filter = { status: 'Active' }; - return getAllActiveChallengesWithUsersDone(uuid, tokenV3, filter, 1); +function getRestActiveChallengesDone(uuid, tokenV3, filter) { + const mergedFilter = { + ...filter, + status: 'Active', + }; + return getAllActiveChallengesWithUsersDone(uuid, tokenV3, mergedFilter, 1); } /** diff --git a/src/shared/components/challenge-listing/Listing/index.jsx b/src/shared/components/challenge-listing/Listing/index.jsx index 4cb0456b56..814bde49ec 100644 --- a/src/shared/components/challenge-listing/Listing/index.jsx +++ b/src/shared/components/challenge-listing/Listing/index.jsx @@ -216,7 +216,7 @@ Listing.propTypes = { setSort: PT.func.isRequired, sorts: PT.shape().isRequired, pastSearchTimestamp: PT.number, - userChallenges: PT.arrayOf(PT.shape()), + userChallenges: PT.arrayOf(PT.string), isLoggedIn: PT.bool.isRequired, }; diff --git a/src/shared/containers/challenge-listing/Listing/index.jsx b/src/shared/containers/challenge-listing/Listing/index.jsx index 4202cae17b..f657e33156 100644 --- a/src/shared/containers/challenge-listing/Listing/index.jsx +++ b/src/shared/containers/challenge-listing/Listing/index.jsx @@ -103,7 +103,8 @@ export class ListingContainer extends React.Component { if (!loadingActiveChallengesUUID && !_.isEmpty(meta) && !allActiveChallengesLoaded && BUCKETS.PAST !== activeBucket) { - getRestActiveChallenges(auth.tokenV3); + const f = this.getBackendFilter(); + getRestActiveChallenges(auth.tokenV3, f.back); } setTimeout(() => { @@ -134,8 +135,8 @@ export class ListingContainer extends React.Component { ); if (communityFilter) communityFilter = communityFilter.challengeFilter; if (communityFilter) filter = combine(filter, communityFilter); - if (communityId && groupIds.length > 0) { - filter.groupIds = groupIds; + if (communityId && !_.isEmpty(groupIds)) { + filter.groups = groupIds; } return { back: mapToBackend(filter), @@ -475,10 +476,10 @@ function mapDispatchToProps(dispatch) { dispatch(a.getActiveChallengesInit(uuid, page, frontFilter)); dispatch(a.getActiveChallengesDone(uuid, page, filter, token, frontFilter)); }, - getRestActiveChallenges: (token) => { + getRestActiveChallenges: (token, filter) => { const uuid = shortId(); dispatch(a.getRestActiveChallengesInit(uuid)); - dispatch(a.getRestActiveChallengesDone(uuid, token)); + dispatch(a.getRestActiveChallengesDone(uuid, token, filter)); }, getCommunitiesList: (auth) => { const uuid = shortId();