Skip to content

Commit 8d04864

Browse files
committed
Fix Issue #4341 Update 1
1 parent 26a43a5 commit 8d04864

File tree

3 files changed

+5
-14
lines changed

3 files changed

+5
-14
lines changed

src/components/TeamManagement/CopilotManagementDialog.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class ProjectManagementDialog extends React.Component {
183183
{i === 0 && !canManageCopilots && <div className="dialog-no-members" />}
184184
</div>
185185

186-
{canInviteCopilots && (
186+
{canManageCopilots && (
187187
<div className="input-container">
188188
<div className="hint">invite more copilots</div>
189189
<AutocompleteInputContainer
@@ -210,7 +210,7 @@ class ProjectManagementDialog extends React.Component {
210210
</button>
211211
</div>
212212
)}
213-
{!canInviteCopilots && <div className="dialog-placeholder" />}
213+
{!canManageCopilots && <div className="dialog-placeholder" />}
214214
</div>
215215

216216
</Modal>

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>

src/config/permissions.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -252,17 +252,6 @@ export const PERMISSIONS = {
252252
projectRoles: [PROJECT_ROLE_COPILOT],
253253
},
254254

255-
INVITE_COPILOTS: {
256-
meta: {
257-
group: 'Project Members',
258-
title: 'Invite Copilots',
259-
description: 'Invite copilots to the project.',
260-
},
261-
topcoderRoles: [
262-
...TOPCODER_ADMINS
263-
]
264-
},
265-
266255
MANAGE_TOPCODER_TEAM: {
267256
meta: {
268257
group: 'Project Members',

0 commit comments

Comments
 (0)