Skip to content

Commit 9138860

Browse files
authored
Merge pull request #215 from topcoder-platform/issue-4700
issue-4700 : Filter registrants with Submitters only
2 parents 70e97da + 52ccdd5 commit 9138860

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/services/challenges.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -399,14 +399,18 @@ class ChallengesService {
399399
*/
400400
async getChallengeRegistrants(challengeId) {
401401
/* If no token provided, resource will return Submitter role only */
402+
const roleId = this.private.tokenV3 ? await this.getRoleId('Submitter') : '';
402403
const params = {
403404
challengeId,
404-
roleId: this.private.tokenV3 ? await this.getRoleId('Submitter') : '',
405+
roleId,
405406
};
406407

407-
const registrants = await this.private.apiV5.get(`/resources?${qs.stringify(params)}`)
408+
let registrants = await this.private.apiV5.get(`/resources?${qs.stringify(params)}`)
408409
.then(checkErrorV5).then(res => res.result);
409410

411+
/* API will return all roles to currentUser, so need to filter in FE */
412+
registrants = _.filter(registrants, r => r.roleId === roleId);
413+
410414
return registrants || [];
411415
}
412416

0 commit comments

Comments
 (0)