Skip to content

Commit 1c4dd3a

Browse files
authored
Merge pull request #576 from topcoder-platform/fix/update-validation
validation updates
2 parents 8ce4e02 + 28d1646 commit 1c4dd3a

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/common/challenge-helper.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ class ChallengeHelper {
117117
await ensureAcessibilityToModifiedGroups(currentUser, data, challenge);
118118
}
119119

120+
// Ensure descriptionFormat is either 'markdown' or 'html'
121+
if (data.descriptionFormat && !_.includes(["markdown", "html"], data.descriptionFormat)) {
122+
throw new errors.BadRequestError("The property 'descriptionFormat' must be either 'markdown' or 'html'");
123+
}
124+
120125
// Ensure unchangeable fields are not changed
121126
if (
122127
_.get(challenge, "legacy.track") &&

src/services/ChallengeService.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,6 +1519,11 @@ async function updateChallenge(currentUser, challengeId, data) {
15191519
_.set(data, "billing.markup", markup || 0);
15201520
}
15211521

1522+
// Make sure the user cannot change the direct project ID
1523+
if (data.legacy && data.legacy.directProjectId) {
1524+
_.unset(data, "legacy.directProjectId", directProjectId);
1525+
}
1526+
15221527
/* BEGIN self-service stuffs */
15231528

15241529
// TODO: At some point in the future this should be moved to a Self-Service Challenge Helper

0 commit comments

Comments
 (0)