Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/shared/containers/challenge-listing/Listing/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ export class ListingContainer extends React.Component {
// activeBucket,
auth,
// dropChallenges,
communityId,
communitiesList,
getCommunitiesList,
// allActiveChallengesLoaded,
// getRestActiveChallenges,
Expand All @@ -134,6 +136,7 @@ export class ListingContainer extends React.Component {
getPastChallenges,
filterState,
loading,
setFilter,
} = this.props;
const oldUserId = _.get(prevProps, 'auth.user.userId');
const userId = _.get(this.props, 'auth.user.userId');
Expand Down Expand Up @@ -177,6 +180,23 @@ export class ListingContainer extends React.Component {
bucket = 'openForRegistration';
}

if (prevProps.communitiesList.data.length !== communitiesList.data.length) {
let selectedCommunity;
if (communityId) {
selectedCommunity = communitiesList.data.find(item => item.communityId === communityId);
}
if (selectedCommunity) {
const groups = selectedCommunity.groupIds && selectedCommunity.groupIds.length
? [selectedCommunity.groupIds[0]] : [];
// update the challenge listing filter for selected community
setFilter({
..._.clone(filter),
groups,
events: [],
});
}
}

if (bucket) {
switch (bucket) {
case BUCKETS.MY: {
Expand Down
3 changes: 2 additions & 1 deletion src/shared/routes/Communities/ChallengeListing.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export default function ChallengeListingRoute({

let { communityId } = query;
if (!communityId
&& !_.get(meta, 'challengeListing.ignoreCommunityFilterByDefault')) {
&& (!_.get(meta, 'challengeListing.ignoreCommunityFilterByDefault')
|| meta.communityId === 'wipro')) {
({ communityId } = meta);
}

Expand Down