@@ -1182,7 +1182,12 @@ createChallenge.schema = {
1182
1182
projectId : Joi . number ( ) . integer ( ) . positive ( ) ,
1183
1183
legacyId : Joi . number ( ) . integer ( ) . positive ( ) ,
1184
1184
startDate : Joi . date ( ) . iso ( ) ,
1185
- status : Joi . string ( ) . valid ( [ constants . challengeStatuses . Active , constants . challengeStatuses . New , constants . challengeStatuses . Draft , constants . challengeStatuses . Approved ] ) ,
1185
+ status : Joi . string ( ) . valid ( [
1186
+ constants . challengeStatuses . Active ,
1187
+ constants . challengeStatuses . New ,
1188
+ constants . challengeStatuses . Draft ,
1189
+ constants . challengeStatuses . Approved ,
1190
+ ] ) ,
1186
1191
groups : Joi . array ( ) . items ( Joi . optionalId ( ) ) . unique ( ) ,
1187
1192
// gitRepoURLs: Joi.array().items(Joi.string().uri()),
1188
1193
terms : Joi . array ( ) . items (
@@ -1428,7 +1433,7 @@ async function updateChallenge(currentUser, challengeId, data) {
1428
1433
data = sanitizeData ( sanitizeChallenge ( data ) , challenge ) ;
1429
1434
console . debug ( "Sanitized Data:" , data ) ;
1430
1435
1431
- validateChallengeUpdateRequest ( currentUser , challenge , data ) ;
1436
+ await validateChallengeUpdateRequest ( currentUser , challenge , data ) ;
1432
1437
1433
1438
let sendActivationEmail = false ;
1434
1439
let sendSubmittedEmail = false ;
@@ -1615,7 +1620,12 @@ async function updateChallenge(currentUser, challengeId, data) {
1615
1620
const finalStatus = data . status || challenge . status ;
1616
1621
const finalTimelineTemplateId = data . timelineTemplateId || challenge . timelineTemplateId ;
1617
1622
let timelineTemplateChanged = false ;
1618
- if ( ! currentUser . isMachine && ! hasAdminRole ( currentUser ) && ! _ . get ( data , "legacy.pureV5" ) && ! _ . get ( challenge , "legacy.pureV5" ) ) {
1623
+ if (
1624
+ ! currentUser . isMachine &&
1625
+ ! hasAdminRole ( currentUser ) &&
1626
+ ! _ . get ( data , "legacy.pureV5" ) &&
1627
+ ! _ . get ( challenge , "legacy.pureV5" )
1628
+ ) {
1619
1629
if (
1620
1630
finalStatus !== constants . challengeStatuses . New &&
1621
1631
finalTimelineTemplateId !== challenge . timelineTemplateId
@@ -1748,7 +1758,9 @@ async function updateChallenge(currentUser, challengeId, data) {
1748
1758
const { track, type } = await challengeHelper . validateAndGetChallengeTypeAndTrack ( {
1749
1759
typeId : challenge . typeId ,
1750
1760
trackId : challenge . trackId ,
1751
- timelineTemplateId : timelineTemplateChanged ? finalTimelineTemplateId : challenge . timelineTemplateId ,
1761
+ timelineTemplateId : timelineTemplateChanged
1762
+ ? finalTimelineTemplateId
1763
+ : challenge . timelineTemplateId ,
1752
1764
} ) ;
1753
1765
1754
1766
if ( _ . get ( type , "isTask" ) ) {
0 commit comments