Skip to content

Commit

Permalink
fixed admin room access issues (#5543)
Browse files Browse the repository at this point in the history
* fixed admin room access issues

* fixed eslint errors

* updated to use room shared boolean over owner name
  • Loading branch information
SilentFlameCR authored Nov 21, 2023
1 parent b3c3d0e commit 2d369da
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import useDeleteSharedAccess from '../../../../hooks/mutations/shared_accesses/u
import useSharedUsers from '../../../../hooks/queries/shared_accesses/useSharedUsers';
import SharedAccessEmpty from './SharedAccessEmpty';
import useRoom from '../../../../hooks/queries/rooms/useRoom';
import { useAuth } from '../../../../contexts/auth/AuthProvider';

export default function SharedAccess() {
const { t } = useTranslation();
Expand All @@ -37,6 +38,8 @@ export default function SharedAccess() {
const { data: sharedUsers } = useSharedUsers(friendlyId, searchInput);
const deleteSharedAccess = useDeleteSharedAccess(friendlyId);
const { data: room } = useRoom(friendlyId);
const currentUser = useAuth();
const isAdmin = currentUser?.role.name === 'Administrator';

if (sharedUsers?.length || searchInput) {
return (
Expand All @@ -45,7 +48,7 @@ export default function SharedAccess() {
<div>
<SearchBar searchInput={searchInput} setSearchInput={setSearchInput} />
</div>
{ !room.shared && (
{ (!room.shared || isAdmin) && (
<Modal
modalButton={(
<Button
Expand Down Expand Up @@ -82,7 +85,7 @@ export default function SharedAccess() {
</Stack>
</td>
<td>
{!room.shared && (
{ (!room.shared || isAdmin) && (
<Button
variant="icon"
className="float-end pe-2"
Expand Down

0 comments on commit 2d369da

Please sign in to comment.