Skip to content

Commit 2d03ead

Browse files
authored
Merge pull request #4377 from diwosuwanto/issue-4341
Fix issue #4341: show the Invite Copilot button
2 parents 124af87 + 2fdf75e commit 2d03ead

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/components/TeamManagement/TeamManagement.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,10 @@ class TeamManagement extends React.Component {
114114
const copilotRemoveAction = hasPermission(PERMISSIONS.REMOVE_COPILOTS)
115115
const copilotViewAction = hasPermission(PERMISSIONS.VIEW_COPILOTS)
116116
const canRequestCopilot = hasPermission(PERMISSIONS.REQUEST_COPILOTS)
117+
const canManageCopilots = hasPermission(PERMISSIONS.MANAGE_COPILOTS)
117118
const copilotRequestLink = `https://topcoder.typeform.com/to/YJ7AL4p8#handle=${currentUser.handle}&projectid=${projectId}`
118119
const canJoinTopcoderTeam = !currentMember && hasPermission(PERMISSIONS.JOIN_TOPCODER_TEAM)
120+
const hasCopilot = members.some(member => member.role === 'copilot')
119121

120122
const sortedMembers = members
121123
let projectTeamInviteCount = 0
@@ -194,7 +196,7 @@ class TeamManagement extends React.Component {
194196
<div className="projects-team">
195197
<div className="title">
196198
<span styleName="title-text">Copilot</span>
197-
{(copilotTeamManageAction || copilotRemoveAction || copilotViewAction) &&
199+
{((copilotTeamManageAction || copilotRemoveAction || copilotViewAction) && (canManageCopilots || hasCopilot)) &&
198200
<span className="title-action" onClick={() => onShowCopilotDialog(true)}>
199201
{(copilotTeamManageAction || copilotRemoveAction) ? 'Manage' : 'View'}
200202
</span>

0 commit comments

Comments
 (0)