Skip to content

Commit 1d77b48

Browse files
Merge pull request #401 from topcoder-platform/revert-400-hot-fix/groups-query
Revert "Hot fix/groups query"
2 parents 10603a1 + 7011a53 commit 1d77b48

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/services/ChallengeService.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,12 +414,16 @@ async function searchChallenges (currentUser, criteria) {
414414
mustNotQuery.push({ exists: { field: 'groups' } })
415415
} else if (!currentUser.isMachine && !helper.hasAdminRole(currentUser)) {
416416
// If the user is not M2M and is not an admin, return public + challenges from groups the user can access
417-
groupsQuery.push({ terms: { groups: accessibleGroups } })
417+
_.each(accessibleGroups, (g) => {
418+
groupsQuery.push({ match_phrase: { groups: g } })
419+
})
418420
// include public challenges
419421
groupsQuery.push({ bool: { must_not: { exists: { field: 'groups' } } } })
420422
}
421423
} else {
422-
groupsQuery.push({ terms: { groups: groupsToFilter } })
424+
_.each(groupsToFilter, (g) => {
425+
groupsQuery.push({ match_phrase: { groups: g } })
426+
})
423427
}
424428

425429
if (criteria.ids) {

0 commit comments

Comments
 (0)