Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 52ccdd5

Browse files
committedAug 4, 2020
issue-4700 : Filter registrants with Submitters only
1 parent 70e97da commit 52ccdd5

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)
Please sign in to comment.