From a301e68946e97517b94a94b85102df2bc5ee3cb0 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Mon, 2 May 2022 12:36:43 +1000 Subject: [PATCH 1/3] https://github.com/topcoder-platform/work-manager/issues/1388 --- src/components/ChallengeEditor/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/ChallengeEditor/index.js b/src/components/ChallengeEditor/index.js index 5105607b..c44b1433 100644 --- a/src/components/ChallengeEditor/index.js +++ b/src/components/ChallengeEditor/index.js @@ -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 } From aa801b0362aa7f9f7f39afdc79773e91aa35082e Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Thu, 23 Jun 2022 12:49:45 +0300 Subject: [PATCH 2/3] fix access checks --- src/containers/ChallengeEditor/index.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/containers/ChallengeEditor/index.js b/src/containers/ChallengeEditor/index.js index b63b44f1..66843d05 100644 --- a/src/containers/ChallengeEditor/index.js +++ b/src/containers/ChallengeEditor/index.js @@ -175,9 +175,6 @@ class ChallengeEditor extends Component { if (isAdmin) { return true } - if (!hasProjectAccess) { - return false - } const userRoles = _.filter( challengeResources, cr => cr.memberId === `${loggedInUser.userId}` @@ -185,7 +182,7 @@ class ChallengeEditor extends Component { const userResourceRoles = _.filter(resourceRoles, rr => _.some(userRoles, ur => ur.roleId === rr.id) ) - return _.some( + return hasProjectAccess || _.some( userResourceRoles, urr => urr.fullWriteAccess && urr.isActive ) From 98340c59762e1a1761638089cf06269cb54c92a1 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Mon, 4 Jul 2022 18:28:22 +0300 Subject: [PATCH 3/3] enable editing of self service challenges --- src/components/ChallengeEditor/ChallengeViewTabs/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/ChallengeEditor/ChallengeViewTabs/index.js b/src/components/ChallengeEditor/ChallengeViewTabs/index.js index ae890736..eecef944 100644 --- a/src/components/ChallengeEditor/ChallengeViewTabs/index.js +++ b/src/components/ChallengeEditor/ChallengeViewTabs/index.js @@ -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 @@ -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 ( @@ -168,10 +168,10 @@ const ChallengeViewTabs = ({ )} )} - {enableEdit && !isSelfService && ( + {enableEdit && ( )} - {isSelfService && isDraft && (isAdmin || isSelfServiceCopilot) && ( + {isSelfService && isDraft && (isAdmin || isSelfServiceCopilot || enableEdit) && (