Skip to content

Commit 1d67c57

Browse files
allow changing of timeline template ID on pureV5 challenges
1 parent e3625d4 commit 1d67c57

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/services/ChallengeService.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,8 +1410,10 @@ async function update (currentUser, challengeId, data, isFull) {
14101410
// TODO: Fix this Tech Debt once legacy is turned off
14111411
const finalStatus = data.status || challenge.status
14121412
const finalTimelineTemplateId = data.timelineTemplateId || challenge.timelineTemplateId
1413-
if (finalStatus !== constants.challengeStatuses.New && finalTimelineTemplateId !== challenge.timelineTemplateId) {
1414-
throw new errors.BadRequestError(`Cannot change the timelineTemplateId for challenges with status: ${finalStatus}`)
1413+
if (!_.get(data, 'legacy.pureV5') && !_.get(challenge, 'legacy.pureV5')) {
1414+
if (finalStatus !== constants.challengeStatuses.New && finalTimelineTemplateId !== challenge.timelineTemplateId) {
1415+
throw new errors.BadRequestError(`Cannot change the timelineTemplateId for challenges with status: ${finalStatus}`)
1416+
}
14151417
}
14161418

14171419
if (data.prizeSets) {

0 commit comments

Comments
 (0)