Skip to content

Commit

Permalink
Merge pull request #2410 from tom0827/TRACK-186
Browse files Browse the repository at this point in the history
TRACK-186: only active team members can edit a work
  • Loading branch information
tom0827 authored Oct 4, 2024
2 parents 70091cc + c0bdd02 commit 04e9d73
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions epictrack-web/src/components/workPlan/event/EventList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ const EventList = () => {
setWork,
} = useContext(WorkplanContext);
const { email } = useAppSelector((state) => state.user.userDetail);
const userIsTeamMember = useMemo(
() => team.some((member) => member.staff.email === email),
const userIsActiveTeamMember = useMemo(
() =>
team.some((member) => member.staff.email === email && member.is_active),
[team, email]
);
const isConfettiShown = useAppSelector((state) => state.uiState.showConfetti);
Expand Down Expand Up @@ -798,7 +799,7 @@ const EventList = () => {
<Restricted
allowed={[ROLES.CREATE]}
errorProps={{ disabled: true }}
exception={userIsTeamMember}
exception={userIsActiveTeamMember}
>
<Button variant="contained" onClick={() => setShowTaskForm(true)}>
Add Task
Expand All @@ -809,7 +810,7 @@ const EventList = () => {
<Restricted
allowed={[ROLES.CREATE]}
errorProps={{ disabled: true }}
exception={userIsTeamMember}
exception={userIsActiveTeamMember}
>
<Button variant="outlined" onClick={onAddMilestone}>
Add Milestone
Expand Down Expand Up @@ -910,7 +911,7 @@ const EventList = () => {
<Restricted
allowed={[ROLES.EDIT]}
errorProps={{ disabled: true }}
exception={userIsTeamMember}
exception={userIsActiveTeamMember}
>
<IButton onClick={handleExportToSheet}>
<DownloadIcon className="icon" />
Expand All @@ -919,7 +920,7 @@ const EventList = () => {
</Tooltip>
<Restricted
allowed={[ROLES.EXTENDED_EDIT]}
exception={userIsTeamMember}
exception={userIsActiveTeamMember}
>
<Tooltip title="Import tasks from an excel sheet">
<Button
Expand Down

0 comments on commit 04e9d73

Please sign in to comment.