Files
twenty/packages
Weiko ebe067f65c Fix favorite showing non-readable objects (#22217)
## Context
Navigation menu items backed by objects the user has no read permission
on were correctly hidden from the Workspace section, but Favorites still
showed them. Favorites are user-scoped nav items (tied to
workspaceMemberId), and FavoritesSection only filtered out folder
children (!item.folderId) without ever checking canReadObjectRecords.

The shared upstream filter (filterAndSortNavigationMenuItems)
intentionally does not apply read permissions, because its output also
drives drag-and-drop position math and layout-customization/edit mode,
which need the complete, unfiltered list. So read-permission filtering
belongs at the display layer.

## Fix
New shared hook useReadableNavigationMenuItems that centralizes the
read-permission filtering logic previously duplicated across sections:
wires up objectMetadataItems + views + object permissions around
isNavigationMenuItemReadable
filters folder children and top-level items (dropping folders whose
children are all unreadable)
exposes both raw filtered* outputs and
isLayoutCustomizationModeEnabled-aware display* outputs
FavoritesSection now applies the filter via the hook, so unreadable
favorites are hidden — while still showing everything in
layout-customization mode (consistent with the Workspace section).
WorkspaceSectionContainer refactored to consume the same hook, removing
its inline isItemReadable, the dual-map reduce, and inline filtering.

## Before
### With access
<img width="842" height="570" alt="Screenshot 2026-06-25 at 14 01 38"
src="https://github.com/user-attachments/assets/ae51f3c8-c178-4162-84ce-3fe49cf07987"
/>

### Without access
<img width="987" height="590" alt="Screenshot 2026-06-25 at 14 02 08"
src="https://github.com/user-attachments/assets/94dacea3-bd77-4fcb-868d-353ed513b28c"
/>

## After
### Without access
<img width="1001" height="615" alt="Screenshot 2026-06-25 at 14 02 46"
src="https://github.com/user-attachments/assets/e1ccd5d9-8583-4ff1-ab91-6f6d187925c5"
/>


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/twentyhq/twenty/pull/22217?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
2026-06-26 11:55:09 +00:00
..