Skip to content

Commit 297308e

Browse files
Merge pull request #5094 from topcoder-platform/issue-5057
Fix Sub-community challenge listing filter
2 parents a681dae + ee4fa77 commit 297308e

File tree

1 file changed

+12
-1
lines changed
  • src/shared/containers/challenge-listing/Listing

1 file changed

+12
-1
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ export class ListingContainer extends React.Component {
5050
getCommunitiesList,
5151
markHeaderMenu,
5252
selectBucket,
53+
setFilter,
5354
selectCommunity,
5455
queryBucket,
56+
filter,
5557
} = this.props;
5658

5759
markHeaderMenu();
@@ -65,8 +67,10 @@ export class ListingContainer extends React.Component {
6567
getCommunitiesList(auth);
6668
}
6769

70+
let selectedCommunity;
6871
if (communityId) {
6972
selectCommunity(communityId);
73+
selectedCommunity = communitiesList.data.find(item => item.communityId === communityId);
7074
}
7175

7276
if (mounted) {
@@ -76,7 +80,14 @@ export class ListingContainer extends React.Component {
7680
// if (BUCKETS.PAST !== activeBucket) {
7781
// dropChallenges();
7882
// this.loadChallenges();
79-
this.reloadChallenges();
83+
if (!selectedCommunity) {
84+
this.reloadChallenges();
85+
} else {
86+
const groups = selectedCommunity.groupIds && selectedCommunity.groupIds.length
87+
? [selectedCommunity.groupIds[0]] : [];
88+
// update the challenge listing filter for selected community
89+
setFilter({ ..._.clone(filter), groups, events: [] });
90+
}
8091
// }
8192
}
8293

0 commit comments

Comments
 (0)