diff --git a/src/components/ChallengeEditor/ReviewType-Field/index.js b/src/components/ChallengeEditor/ReviewType-Field/index.js
index 139ea0a3..a7ee070f 100644
--- a/src/components/ChallengeEditor/ReviewType-Field/index.js
+++ b/src/components/ChallengeEditor/ReviewType-Field/index.js
@@ -1,3 +1,4 @@
+import _ from 'lodash'
import React from 'react'
import PropTypes from 'prop-types'
import Select from '../../Select'
@@ -9,10 +10,11 @@ import { DES_TRACK_ID, REVIEW_TYPES, MESSAGE, QA_TRACK_ID } from '../../../confi
const ReviewTypeField = ({ reviewers, challenge, onUpdateOthers, onUpdateSelect }) => {
const isDesignChallenge = challenge.trackId === DES_TRACK_ID
const isQAChallenge = challenge.trackId === QA_TRACK_ID
+ const isTask = _.get(challenge, 'task.isTask', false)
const defaultReviewType = isDesignChallenge ? REVIEW_TYPES.INTERNAL : REVIEW_TYPES.COMMUNITY
const reviewType = challenge.reviewType ? challenge.reviewType.toUpperCase() : defaultReviewType
const isCommunity = reviewType === REVIEW_TYPES.COMMUNITY
- const isInternal = reviewType === REVIEW_TYPES.INTERNAL
+ const isInternal = reviewType === REVIEW_TYPES.INTERNAL || isTask
const communityOption = (disabled) => (
}
- { !isDesignChallenge &&
+ { !isDesignChallenge && !isTask &&
communityOption()
}
diff --git a/src/components/ChallengeEditor/index.js b/src/components/ChallengeEditor/index.js
index 605044ff..b776114c 100644
--- a/src/components/ChallengeEditor/index.js
+++ b/src/components/ChallengeEditor/index.js
@@ -776,7 +776,7 @@ class ChallengeEditor extends Component {
}
collectChallengeData (status) {
- const { attachments } = this.props
+ const { attachments, metadata } = this.props
const challenge = pick([
'phases',
'typeId',
@@ -793,6 +793,7 @@ class ChallengeEditor extends Component {
'prizeSets',
'winners'
], this.state.challenge)
+ const isTask = _.find(metadata.challengeTypes, { id: challenge.typeId, isTask: true })
challenge.legacy = _.assign(this.state.challenge.legacy, {
reviewType: challenge.reviewType
})
@@ -803,6 +804,10 @@ class ChallengeEditor extends Component {
return { ...p, prizes }
})
challenge.status = status
+ if (status === 'Active' && isTask) {
+ challenge.startDate = moment().format()
+ }
+
if (this.state.challenge.id) {
challenge.attachmentIds = _.map(attachments, item => item.id)
}
@@ -837,7 +842,7 @@ class ChallengeEditor extends Component {
const avlTemplates = this.getAvailableTimelineTemplates()
// chooses first available timeline template or fallback template for the new challenge
const defaultTemplate = avlTemplates && avlTemplates.length > 0 ? avlTemplates[0] : STD_DEV_TIMELINE_TEMPLATE
-
+ const isTask = _.find(metadata.challengeTypes, { id: typeId, isTask: true })
const newChallenge = {
status: 'New',
projectId: this.props.projectId,
@@ -846,7 +851,7 @@ class ChallengeEditor extends Component {
trackId,
startDate: moment().add(1, 'days').format(),
legacy: {
- reviewType: isDesignChallenge ? REVIEW_TYPES.INTERNAL : REVIEW_TYPES.COMMUNITY
+ reviewType: isTask || isDesignChallenge ? REVIEW_TYPES.INTERNAL : REVIEW_TYPES.COMMUNITY
},
descriptionFormat: 'markdown',
timelineTemplateId: defaultTemplate.id,
@@ -859,6 +864,10 @@ class ChallengeEditor extends Component {
}
try {
const action = await createChallenge(newChallenge)
+ if (isTask) {
+ await this.updateResource(action.challengeDetails.id, 'Reviewer', action.challengeDetails.createdBy, action.challengeDetails.reviewer)
+ action.challengeDetails.reviewer = action.challengeDetails.createdBy
+ }
const draftChallenge = {
data: action.challengeDetails
}
@@ -1399,7 +1408,7 @@ class ChallengeEditor extends Component {
)}
- {
+ {!isTask && (
- }
+ )}
{
this.state.isDeleteLaunch && !this.state.isConfirm && (