Skip to content

Commit fd7ace5

Browse files
committed
fix for issue #4384
1 parent 163da0b commit fd7ace5

File tree

4 files changed

+7
-15
lines changed

4 files changed

+7
-15
lines changed

src/shared/actions/challenge-listing/index.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,22 +95,15 @@ function getAllActiveChallengesWithUsersDone(uuid, tokenV3, filter, page = 0) {
9595
let user;
9696
if (tokenV3) {
9797
user = decodeToken(tokenV3).userId;
98-
99-
const newFilter = _.mapKeys(filter, (value, key) => {
100-
if (key === 'tag') return 'technologies';
101-
102-
return key;
103-
});
104-
10598
// Handle any errors on this endpoint so that the non-user specific challenges
10699
// will still be loaded.
107-
calls.push(getAll(params => service.getUserChallenges(user, newFilter, params)
108-
.catch(() => ({ challenges: [] }))), page);
100+
calls.push(getAll(service.getUserChallenges(user).catch(() => ({ challenges: [] }))), page);
109101
}
110102
return Promise.all(calls).then(([ch, uch]) => {
111103
/* uch array contains challenges where the user is participating in
112104
@@ -111,8 +124,8 @@ function getAllActiveChallengesDone(uuid, tokenV3) {
113105
* challenges in an efficient way. */
106+
114107
if (uch) {
115108
const map = {};
116109
uch.forEach((item) => { map[item.id] = item; });

src/shared/components/challenge-listing/Listing/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function Listing({
4545
expandTag,
4646
pastSearchTimestamp,
4747
}) {
48-
const buckets = getBuckets(_.get(auth.user, 'handle'));
48+
const buckets = getBuckets(_.get(auth.user, 'userId'));
4949
const isChallengesAvailable = (bucket) => {
5050
const filter = Filter.getFilterFunction(buckets[bucket].filter);
5151
const clonedChallenges = _.clone(challenges);

src/shared/containers/challenge-listing/Sidebar.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class SidebarContainer extends React.Component {
6262
user,
6363
} = this.props;
6464

65-
const buckets = getBuckets(user && user.handle);
65+
const buckets = getBuckets(user && user.userId);
6666

6767
if (extraBucket) {
6868
buckets[extraBucket.name] = extraBucket;

src/shared/utils/challenge-listing/buckets.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,12 @@ export const NO_LIVE_CHALLENGES_CONFIG = {
132132

133133
/**
134134
* Returns configuration of all possible challenge buckets.
135-
* @param {String} userHandle Handle of the authenticated
135+
* @param {String} userId id of the authenticated
136136
* user to filter out My Challenges.
137137
*/
138-
export function getBuckets(userHandle) {
138+
export function getBuckets(userId) {
139139
const res = _.cloneDeep(BUCKET_DATA);
140-
// TODO: Find equivalent of users
141-
res[BUCKETS.MY].filter.users = [userHandle];
140+
res[BUCKETS.MY].filter.users = [userId];
142141
return res;
143142
}
144143

0 commit comments

Comments
 (0)