Skip to content

Commit

Permalink
fix(frontend): only link request count to user request list if curren…
Browse files Browse the repository at this point in the history
…t user has required perms
  • Loading branch information
TheCatLady committed Mar 29, 2021
1 parent 7153f4e commit 7724a26
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/components/UserList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const UserList: React.FC = () => {
});
const [showBulkEditModal, setShowBulkEditModal] = useState(false);
const [selectedUsers, setSelectedUsers] = useState<number[]>([]);
const { user: currentUser } = useUser();
const { user: currentUser, hasPermission: currentHasPermission } = useUser();

useEffect(() => {
const filterString = window.localStorage.getItem('ul-filter-settings');
Expand Down Expand Up @@ -549,11 +549,19 @@ const UserList: React.FC = () => {
</div>
</Table.TD>
<Table.TD>
<Link href={`/users/${user.id}/requests`}>
<a className="text-sm leading-5 transition duration-300 hover:underline">
{user.requestCount}
</a>
</Link>
{user.id === currentUser?.id ||
currentHasPermission(
[Permission.MANAGE_REQUESTS, Permission.REQUEST_VIEW],
{ type: 'or' }
) ? (
<Link href={`/users/${user.id}/requests`}>
<a className="text-sm leading-5 transition duration-300 hover:underline">
{user.requestCount}
</a>
</Link>
) : (
user.requestCount
)}
</Table.TD>
<Table.TD>
{user.userType === UserType.PLEX ? (
Expand Down

0 comments on commit 7724a26

Please sign in to comment.