Skip to content

Commit

Permalink
show inaccessible rooms only to admins
Browse files Browse the repository at this point in the history
  • Loading branch information
ajbura committed Feb 21, 2025
1 parent e1683f4 commit fca6e63
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/app/features/lobby/SpaceHierarchy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ export const SpaceHierarchy = forwardRef<HTMLDivElement, SpaceHierarchyProps>(
{childItems && childItems.length > 0 && (
<Box direction="Column" gap="100">
{childItems.map((roomItem, index) => {
const roomSummary = rooms.get(roomItem.roomId);
const inaccessibleRoom = !roomSummary && !fetching && !error;
if (inaccessibleRoom && !canEditSpaceChild(spacePowerLevels)) return null;

const roomPowerLevels = roomsPowerLevels.get(roomItem.roomId) ?? {};
const userPLInRoom = powerLevelAPI.getPowerLevel(
roomPowerLevels,
Expand All @@ -158,7 +162,7 @@ export const SpaceHierarchy = forwardRef<HTMLDivElement, SpaceHierarchyProps>(
item={roomItem}
loading={fetching}
error={error}
summary={rooms.get(roomItem.roomId)}
summary={roomSummary}
dm={mDirects.has(roomItem.roomId)}
onOpen={onOpenRoom}
getRoom={getRoom}
Expand Down

0 comments on commit fca6e63

Please sign in to comment.