Skip to content

Commit

Permalink
Merge pull request #1494 from topcoder-platform/hotfix-pagination-issue
Browse files Browse the repository at this point in the history
Filter challenges by logged in user
  • Loading branch information
jmgasper authored Feb 15, 2023
2 parents 8b15e66 + 17c8f6a commit 4915462
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/actions/challenges.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export function loadChallengesByPage (
filterChallengeName = null,
selfService = false,
userHandle = null,
filterCreatedBy = null,
filterChallengeType = {},
filterDate = {},
filterSortBy = null,
Expand Down Expand Up @@ -125,6 +126,9 @@ export function loadChallengesByPage (
if (filterSortBy) {
filters['sortBy'] = filterSortBy
}
if (filterCreatedBy) {
filters['createdBy'] = filterCreatedBy
}
if (filterSortOrder) {
filters['sortOrder'] = filterSortOrder
}
Expand Down
12 changes: 11 additions & 1 deletion src/components/ChallengesComponent/ChallengeList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class ChallengeList extends Component {
searchText,
selfService,
this.getHandle(),
this.getLoginHandle(),
challengeType,
challengeDate
)
Expand Down Expand Up @@ -152,6 +153,7 @@ class ChallengeList extends Component {
searchText,
selfService,
this.getHandle(),
this.getLoginHandle(),
filterChallengeType,
filterDate,
sortBy,
Expand Down Expand Up @@ -189,6 +191,7 @@ class ChallengeList extends Component {
searchText,
selfService,
this.getHandle(),
this.getLoginHandle(),
filterChallengeType,
filterDate,
sortBy,
Expand Down Expand Up @@ -216,7 +219,8 @@ class ChallengeList extends Component {
status,
searchText,
selfService,
this.getHandle()
this.getHandle(),
this.getLoginHandle()
)
}

Expand Down Expand Up @@ -251,6 +255,10 @@ class ChallengeList extends Component {
if (checkAdmin(this.props.auth.token)) {
return null
}
return this.getLoginHandle()
}

getLoginHandle () {
return this.props.auth && this.props.auth.user
? this.props.auth.user.handle
: null
Expand Down Expand Up @@ -290,6 +298,7 @@ class ChallengeList extends Component {
searchText,
selfService,
this.getHandle(),
this.getLoginHandle(),
challengeType,
challengeDate,
name,
Expand Down Expand Up @@ -335,6 +344,7 @@ class ChallengeList extends Component {
'',
selfService,
this.getHandle(),
this.getLoginHandle(),
null,
{},
null,
Expand Down
9 changes: 5 additions & 4 deletions src/containers/Challenges/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Challenges extends Component {
} = this.props
loadChallengeTypes()
if (dashboard) {
this.reloadChallenges(this.props, true)
this.reloadChallenges(this.props, true, true)
}
if (menu === 'NULL' && activeProjectId !== -1) {
resetSidebarActiveParams()
Expand All @@ -62,11 +62,11 @@ class Challenges extends Component {
(nextProps.dashboard && this.props.dashboard !== nextProps.dashboard) ||
this.props.activeProjectId !== nextProps.activeProjectId
) {
this.reloadChallenges(nextProps)
this.reloadChallenges(nextProps, false, true)
}
}

reloadChallenges (props, forceLoad) {
reloadChallenges (props, forceLoad, loadMyChallenge) {
const {
activeProjectId,
projectDetail: reduxProjectInfo,
Expand All @@ -84,7 +84,8 @@ class Challenges extends Component {
dashboard ? 'all' : '',
'',
selfService,
isAdmin ? null : this.props.auth.user.handle
isAdmin ? null : this.props.auth.user.handle,
loadMyChallenge ? this.props.auth.user.handle : ''
)
const projectLoading =
window.localStorage.getItem('projectLoading') !== null
Expand Down

0 comments on commit 4915462

Please sign in to comment.