Skip to content

Commit 70c8f4a

Browse files
authored
Merge pull request #1112 from topcoder-platform/pm-1273
fix(PM-1273): show apply copilot only for projects where user is not a member
2 parents 036d0cd + 4ca0221 commit 70c8f4a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/apps/copilots/src/models/CopilotOpportunity.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ export interface CopilotOpportunity {
2222
startDate: Date,
2323
tzRestrictions: 'yes' | 'no',
2424
createdAt: Date,
25+
members: Array<number>,
2526
}

src/apps/copilots/src/pages/copilot-opportunity-details/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ const CopilotOpportunityDetails: FC<{}> = () => {
125125
}
126126

127127
const application = copilotApplications && copilotApplications[0]
128+
const isAlreadyMemberOfTheProject = profile && opportunity?.members?.includes(profile.userId)
128129

129130
return (
130131
<ContentLayout
@@ -133,7 +134,8 @@ const CopilotOpportunityDetails: FC<{}> = () => {
133134
isCopilot
134135
&& copilotApplications
135136
&& copilotApplications.length === 0
136-
&& opportunity?.status === 'active' ? applyCopilotOpportunityButton : undefined
137+
&& opportunity?.status === 'active'
138+
&& !isAlreadyMemberOfTheProject ? applyCopilotOpportunityButton : undefined
137139
}
138140
infoComponent={(isCopilot && !(copilotApplications
139141
&& copilotApplications.length === 0

0 commit comments

Comments
 (0)