@@ -776,7 +776,7 @@ class ChallengeEditor extends Component {
776
776
}
777
777
778
778
collectChallengeData ( status ) {
779
- const { attachments } = this . props
779
+ const { attachments, metadata } = this . props
780
780
const challenge = pick ( [
781
781
'phases' ,
782
782
'typeId' ,
@@ -793,6 +793,7 @@ class ChallengeEditor extends Component {
793
793
'prizeSets' ,
794
794
'winners'
795
795
] , this . state . challenge )
796
+ const isTask = _ . find ( metadata . challengeTypes , { id : challenge . typeId , isTask : true } )
796
797
challenge . legacy = _ . assign ( this . state . challenge . legacy , {
797
798
reviewType : challenge . reviewType
798
799
} )
@@ -803,6 +804,10 @@ class ChallengeEditor extends Component {
803
804
return { ...p , prizes }
804
805
} )
805
806
challenge . status = status
807
+ if ( status === 'Active' && isTask ) {
808
+ challenge . startDate = moment ( ) . format ( )
809
+ }
810
+
806
811
if ( this . state . challenge . id ) {
807
812
challenge . attachmentIds = _ . map ( attachments , item => item . id )
808
813
}
@@ -837,7 +842,7 @@ class ChallengeEditor extends Component {
837
842
const avlTemplates = this . getAvailableTimelineTemplates ( )
838
843
// chooses first available timeline template or fallback template for the new challenge
839
844
const defaultTemplate = avlTemplates && avlTemplates . length > 0 ? avlTemplates [ 0 ] : STD_DEV_TIMELINE_TEMPLATE
840
-
845
+ const isTask = _ . find ( metadata . challengeTypes , { id : typeId , isTask : true } )
841
846
const newChallenge = {
842
847
status : 'New' ,
843
848
projectId : this . props . projectId ,
@@ -846,7 +851,7 @@ class ChallengeEditor extends Component {
846
851
trackId,
847
852
startDate : moment ( ) . add ( 1 , 'days' ) . format ( ) ,
848
853
legacy : {
849
- reviewType : isDesignChallenge ? REVIEW_TYPES . INTERNAL : REVIEW_TYPES . COMMUNITY
854
+ reviewType : isTask || isDesignChallenge ? REVIEW_TYPES . INTERNAL : REVIEW_TYPES . COMMUNITY
850
855
} ,
851
856
descriptionFormat : 'markdown' ,
852
857
timelineTemplateId : defaultTemplate . id ,
@@ -859,6 +864,10 @@ class ChallengeEditor extends Component {
859
864
}
860
865
try {
861
866
const action = await createChallenge ( newChallenge )
867
+ if ( isTask ) {
868
+ await this . updateResource ( action . challengeDetails . id , 'Reviewer' , action . challengeDetails . createdBy , action . challengeDetails . reviewer )
869
+ action . challengeDetails . reviewer = action . challengeDetails . createdBy
870
+ }
862
871
const draftChallenge = {
863
872
data : action . challengeDetails
864
873
}
@@ -1399,7 +1408,7 @@ class ChallengeEditor extends Component {
1399
1408
< GroupsField groups = { metadata . groups } onUpdateMultiSelect = { this . onUpdateMultiSelect } challenge = { challenge } />
1400
1409
</ React . Fragment >
1401
1410
) }
1402
- {
1411
+ { ! isTask && (
1403
1412
< div className = { styles . PhaseRow } >
1404
1413
< PhaseInput
1405
1414
withDates
@@ -1414,7 +1423,7 @@ class ChallengeEditor extends Component {
1414
1423
readOnly = { false }
1415
1424
/>
1416
1425
</ div >
1417
- }
1426
+ ) }
1418
1427
{
1419
1428
this . state . isDeleteLaunch && ! this . state . isConfirm && (
1420
1429
< ConfirmationModal
0 commit comments