Skip to content

Commit

Permalink
Merge pull request #1398 from topcoder-platform/develop
Browse files Browse the repository at this point in the history
Prod release
  • Loading branch information
ThomasKranitsas authored Jul 7, 2022
2 parents 8b0d771 + 98340c5 commit a0f5a07
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
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

0 comments on commit a0f5a07

Please sign in to comment.