@@ -776,7 +776,7 @@ class ChallengeEditor extends Component {
776776 }
777777
778778 collectChallengeData ( status ) {
779- const { attachments } = this . props
779+ const { attachments, metadata } = this . props
780780 const challenge = pick ( [
781781 'phases' ,
782782 'typeId' ,
@@ -793,6 +793,7 @@ class ChallengeEditor extends Component {
793793 'prizeSets' ,
794794 'winners'
795795 ] , this . state . challenge )
796+ const isTask = _ . find ( metadata . challengeTypes , { id : challenge . typeId , isTask : true } )
796797 challenge . legacy = _ . assign ( this . state . challenge . legacy , {
797798 reviewType : challenge . reviewType
798799 } )
@@ -803,6 +804,10 @@ class ChallengeEditor extends Component {
803804 return { ...p , prizes }
804805 } )
805806 challenge . status = status
807+ if ( status === 'Active' && isTask ) {
808+ challenge . startDate = moment ( ) . format ( )
809+ }
810+
806811 if ( this . state . challenge . id ) {
807812 challenge . attachmentIds = _ . map ( attachments , item => item . id )
808813 }
@@ -837,7 +842,7 @@ class ChallengeEditor extends Component {
837842 const avlTemplates = this . getAvailableTimelineTemplates ( )
838843 // chooses first available timeline template or fallback template for the new challenge
839844 const defaultTemplate = avlTemplates && avlTemplates . length > 0 ? avlTemplates [ 0 ] : STD_DEV_TIMELINE_TEMPLATE
840-
845+ const isTask = _ . find ( metadata . challengeTypes , { id : typeId , isTask : true } )
841846 const newChallenge = {
842847 status : 'New' ,
843848 projectId : this . props . projectId ,
@@ -846,7 +851,7 @@ class ChallengeEditor extends Component {
846851 trackId,
847852 startDate : moment ( ) . add ( 1 , 'days' ) . format ( ) ,
848853 legacy : {
849- reviewType : isDesignChallenge ? REVIEW_TYPES . INTERNAL : REVIEW_TYPES . COMMUNITY
854+ reviewType : isTask || isDesignChallenge ? REVIEW_TYPES . INTERNAL : REVIEW_TYPES . COMMUNITY
850855 } ,
851856 descriptionFormat : 'markdown' ,
852857 timelineTemplateId : defaultTemplate . id ,
@@ -859,6 +864,10 @@ class ChallengeEditor extends Component {
859864 }
860865 try {
861866 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+ }
862871 const draftChallenge = {
863872 data : action . challengeDetails
864873 }
@@ -1399,7 +1408,7 @@ class ChallengeEditor extends Component {
13991408 < GroupsField groups = { metadata . groups } onUpdateMultiSelect = { this . onUpdateMultiSelect } challenge = { challenge } />
14001409 </ React . Fragment >
14011410 ) }
1402- {
1411+ { ! isTask && (
14031412 < div className = { styles . PhaseRow } >
14041413 < PhaseInput
14051414 withDates
@@ -1414,7 +1423,7 @@ class ChallengeEditor extends Component {
14141423 readOnly = { false }
14151424 />
14161425 </ div >
1417- }
1426+ ) }
14181427 {
14191428 this . state . isDeleteLaunch && ! this . state . isConfirm && (
14201429 < ConfirmationModal
0 commit comments