From 64925df3eb1eda3a36898e1120b9db641468991f Mon Sep 17 00:00:00 2001 From: sarojbehera1 Date: Thu, 12 Oct 2023 14:52:05 +0530 Subject: [PATCH 1/3] Correcting error: removing this --- src/common/challenge-helper.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/challenge-helper.js b/src/common/challenge-helper.js index 485bc179..f83b7016 100644 --- a/src/common/challenge-helper.js +++ b/src/common/challenge-helper.js @@ -119,7 +119,7 @@ class ChallengeHelper { // check groups authorization if (challenge.groups && challenge.groups.length > 0) { if (currentUser.isMachine || hasAdminRole(currentUser)) { - await this.validateGroups(challenge.groups); + await validateGroups(challenge.groups); } else { await helper.ensureAccessibleByGroupsAccess(currentUser, challenge); } @@ -145,7 +145,7 @@ class ChallengeHelper { // check groups access to be updated group values if (data.groups && data.groups.length > 0) { if (currentUser.isMachine || hasAdminRole(currentUser)) { - await this.validateGroups(data.groups); + await validateGroups(data.groups); } else { await ensureAcessibilityToModifiedGroups(currentUser, data, challenge); } From 178ada72224e756ed1a35ee0cc3067586d5e6734 Mon Sep 17 00:00:00 2001 From: sarojbehera1 Date: Thu, 12 Oct 2023 16:42:44 +0530 Subject: [PATCH 2/3] Putting back *this* --- src/common/challenge-helper.js | 4 ++-- src/services/ChallengeService.js | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/common/challenge-helper.js b/src/common/challenge-helper.js index f83b7016..485bc179 100644 --- a/src/common/challenge-helper.js +++ b/src/common/challenge-helper.js @@ -119,7 +119,7 @@ class ChallengeHelper { // check groups authorization if (challenge.groups && challenge.groups.length > 0) { if (currentUser.isMachine || hasAdminRole(currentUser)) { - await validateGroups(challenge.groups); + await this.validateGroups(challenge.groups); } else { await helper.ensureAccessibleByGroupsAccess(currentUser, challenge); } @@ -145,7 +145,7 @@ class ChallengeHelper { // check groups access to be updated group values if (data.groups && data.groups.length > 0) { if (currentUser.isMachine || hasAdminRole(currentUser)) { - await validateGroups(data.groups); + await this.validateGroups(data.groups); } else { await ensureAcessibilityToModifiedGroups(currentUser, data, challenge); } diff --git a/src/services/ChallengeService.js b/src/services/ChallengeService.js index 9b0fd8da..1450cd36 100644 --- a/src/services/ChallengeService.js +++ b/src/services/ChallengeService.js @@ -36,7 +36,6 @@ const { ChallengeDomain } = require("@topcoder-framework/domain-challenge"); const { hasAdminRole } = require("../common/role-helper"); const { - validateChallengeUpdateRequest, enrichChallengeForResponse, sanitizeRepeatedFieldsInUpdateRequest, convertPrizeSetValuesToCents, @@ -1441,7 +1440,7 @@ async function updateChallenge(currentUser, challengeId, data) { data = sanitizeData(sanitizeChallenge(data), challenge); logger.debug(`Sanitized Data: ${JSON.stringify(data)}`); - await validateChallengeUpdateRequest(currentUser, challenge, data); + await challengeHelper.validateChallengeUpdateRequest(currentUser, challenge, data); let sendActivationEmail = false; let sendSubmittedEmail = false; From 64806cbb45f650945438bbf8e569038a33481ceb Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 12 Oct 2023 15:03:31 +0300 Subject: [PATCH 3/3] Update challenge-helper.js to use the this keyword --- src/common/challenge-helper.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/challenge-helper.js b/src/common/challenge-helper.js index 81764aeb..6ee91781 100644 --- a/src/common/challenge-helper.js +++ b/src/common/challenge-helper.js @@ -119,7 +119,7 @@ class ChallengeHelper { // check groups authorization if (challenge.groups && challenge.groups.length > 0) { if (currentUser.isMachine || hasAdminRole(currentUser)) { - await validateGroups(challenge.groups); + await this.validateGroups(challenge.groups); } else { await helper.ensureAccessibleByGroupsAccess(currentUser, challenge); } @@ -145,7 +145,7 @@ class ChallengeHelper { // check groups access to be updated group values if (data.groups && data.groups.length > 0) { if (currentUser.isMachine || hasAdminRole(currentUser)) { - await validateGroups(data.groups); + await this.validateGroups(data.groups); } else { await ensureAcessibilityToModifiedGroups(currentUser, data, challenge); }