Skip to content

Commit 8cd71aa

Browse files
clean-up
1 parent db18d64 commit 8cd71aa

File tree

1 file changed

+5
-3
lines changed
  • src/components/ChallengeEditor/ChallengeViewTabs

1 file changed

+5
-3
lines changed

src/components/ChallengeEditor/ChallengeViewTabs/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,12 @@ const ChallengeViewTabs = ({
8686

8787
const isSelfService = challenge.legacy.selfService
8888
const isDraft = challenge.status.toUpperCase() === CHALLENGE_STATUS.DRAFT
89+
const isCopilot = challenge.legacy.selfServiceCopilot === loggedInUser.handle
90+
const canApprove = isCopilot && isDraft && isSelfService
91+
// only the copilot can launch AND
8992
// if this isn't self-service, permit launching if the challenge is draft
9093
// OR if this is self-service, permit launching if the challenge is approved
91-
const canLaunch = (!isSelfService && isDraft) || challenge.status.toUpperCase() === CHALLENGE_STATUS.APPROVED
92-
const isCopilot = challenge.legacy.selfServiceCopilot === loggedInUser.handle
94+
const canLaunch = isCopilot && ((!isSelfService && isDraft) || challenge.status.toUpperCase() === CHALLENGE_STATUS.APPROVED)
9395

9496
return (
9597
<div className={styles.list}>
@@ -136,7 +138,7 @@ const ChallengeViewTabs = ({
136138
)}
137139
</div>
138140
)}
139-
{isDraft && isSelfService && (
141+
{canApprove && (
140142
<div className={styles.button}>
141143
<PrimaryButton
142144
text='Approve'

0 commit comments

Comments
 (0)