Skip to content

Commit 27f8e76

Browse files
committed
fix(challenge update): disallow updating phase/startdate for completed/cancelled challenges
1 parent 45c6601 commit 27f8e76

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/services/ChallengeService.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1526,8 +1526,8 @@ async function update (currentUser, challengeId, data, isFull) {
15261526
}
15271527

15281528
if (data.phases || data.startDate) {
1529-
if (!(challenge.status === constants.challengeStatuses.Active || challenge.status === constants.challengeStatuses.Draft)) {
1530-
throw new BadRequestError(`Challenge phase/start date can only be modify for "Active" and "Draft" challenges.`)
1529+
if (challenge.status === constants.challengeStatuses.Completed || challenge.status.indexOf(constants.challengeStatuses.Cancelled) > -1) {
1530+
throw new BadRequestError(`Challenge phase/start date can not be modified for Completed or Cancelled challenges.`)
15311531
}
15321532

15331533
if (data.phases && data.phases.length > 0) {

0 commit comments

Comments
 (0)