Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/components/ChallengeEditor/ChallengeViewTabs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const ChallengeViewTabs = ({
const isDraft = challenge.status.toUpperCase() === CHALLENGE_STATUS.DRAFT
const isSelfServiceCopilot = challenge.legacy.selfServiceCopilot === loggedInUser.handle
const isAdmin = checkAdmin(token)
const canApprove = isSelfServiceCopilot && isDraft && isSelfService
const canApprove = (isSelfServiceCopilot || enableEdit) && isDraft && isSelfService
const hasBillingAccount = _.get(projectDetail, 'billingAccountId') !== null
// only challenges that have a billing account can be launched AND
// if this isn't self-service, permit launching if the challenge is draft
Expand All @@ -97,7 +97,7 @@ const ChallengeViewTabs = ({
// b) the challenge is approved
const canLaunch = hasBillingAccount &&
((!isSelfService && isDraft) ||
((isSelfServiceCopilot || isAdmin) &&
((isSelfServiceCopilot || enableEdit || isAdmin) &&
challenge.status.toUpperCase() === CHALLENGE_STATUS.APPROVED))

return (
Expand Down Expand Up @@ -168,10 +168,10 @@ const ChallengeViewTabs = ({
)}
</div>
)}
{enableEdit && !isSelfService && (
{enableEdit && (
<PrimaryButton text={'Edit'} type={'info'} submit link={`./edit`} />
)}
{isSelfService && isDraft && (isAdmin || isSelfServiceCopilot) && (
{isSelfService && isDraft && (isAdmin || isSelfServiceCopilot || enableEdit) && (
<div className={styles.button}>
<PrimaryButton
text='Reject challenge'
Expand Down
3 changes: 1 addition & 2 deletions src/components/ChallengeEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -828,8 +828,7 @@ class ChallengeEditor extends Component {
for (let index = 0; index < phases.length; ++index) {
newChallenge.phases[index].isDurationActive =
moment(newChallenge.phases[index]['scheduledEndDate']).isAfter()
newChallenge.phases[index].isStartTimeActive = index > 0 ? false
: moment(newChallenge.phases[0]['scheduledStartDate']).isAfter()
newChallenge.phases[index].isStartTimeActive = index <= 0
newChallenge.phases[index].isOpen =
newChallenge.phases[index].isDurationActive
}
Expand Down
5 changes: 1 addition & 4 deletions src/containers/ChallengeEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,14 @@ class ChallengeEditor extends Component {
if (isAdmin) {
return true
}
if (!hasProjectAccess) {
return false
}
const userRoles = _.filter(
challengeResources,
cr => cr.memberId === `${loggedInUser.userId}`
)
const userResourceRoles = _.filter(resourceRoles, rr =>
_.some(userRoles, ur => ur.roleId === rr.id)
)
return _.some(
return hasProjectAccess || _.some(
userResourceRoles,
urr => urr.fullWriteAccess && urr.isActive
)
Expand Down