From cf892ffa37ffc7a8ff93c8ac9e0064b1bd3dc331 Mon Sep 17 00:00:00 2001 From: Cagdas U Date: Sun, 23 Aug 2020 23:26:13 +0300 Subject: [PATCH] fix(challenge-utils): update `filterByUsers` to use `userId` Update `filterByUsers` function to use `challenge.users[userId]` property instead of `userChallenges` for filtering. Addresses topcoder-platform/community-app#4782 --- src/utils/challenge/filter.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index 263c3132..d662a230 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -173,8 +173,11 @@ function filterByUpcoming(challenge, state) { } function filterByUsers(challenge, state) { - if (!state.userChallenges) return true; - return state.userChallenges.find(ch => challenge.id === ch); + const userId = _.get(state, 'userId', null); + if (userId) { + return _.get(challenge, ['users', userId], false); + } + return true; } /**