From e4db9bf2725f1714f273332f0a444ec940aae1a8 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sun, 23 Nov 2025 11:21:22 +0000 Subject: fix: Hide shared lists where user is a viewer in Manage Lists dialog (#2164) Users with viewer role cannot add/remove bookmarks from lists, so these lists should not appear in the Manage Lists dialog across all platforms (web, mobile, and extension). Changes: - Web: Updated BookmarkListSelector to filter out viewer lists - Mobile: Updated manage_lists.tsx to filter out viewer lists - Extension: Updated ListsSelector to filter out viewer lists Co-authored-by: Claude --- .../src/components/ListsSelector.tsx | 50 +++++++++++----------- .../dashboard/bookmarks/[slug]/manage_lists.tsx | 6 ++- .../dashboard/lists/BookmarkListSelector.tsx | 9 +++- 3 files changed, 38 insertions(+), 27 deletions(-) (limited to 'apps') diff --git a/apps/browser-extension/src/components/ListsSelector.tsx b/apps/browser-extension/src/components/ListsSelector.tsx index 379338b6..86c151d1 100644 --- a/apps/browser-extension/src/components/ListsSelector.tsx +++ b/apps/browser-extension/src/components/ListsSelector.tsx @@ -74,31 +74,33 @@ export function ListsSelector({ bookmarkId }: { bookmarkId: string }) { You don't have any lists. - {allLists?.allPaths.map((path) => { - const lastItem = path[path.length - 1]; + {allLists?.allPaths + .filter((path) => path[path.length - 1].userRole !== "viewer") + .map((path) => { + const lastItem = path[path.length - 1]; - return ( - - - {path - .map((item) => `${item.icon} ${item.name}`) - .join(" / ")} - - ); - })} + return ( + + + {path + .map((item) => `${item.icon} ${item.name}`) + .join(" / ")} + + ); + })} diff --git a/apps/mobile/app/dashboard/bookmarks/[slug]/manage_lists.tsx b/apps/mobile/app/dashboard/bookmarks/[slug]/manage_lists.tsx index 7250d06b..c502c07f 100644 --- a/apps/mobile/app/dashboard/bookmarks/[slug]/manage_lists.tsx +++ b/apps/mobile/app/dashboard/bookmarks/[slug]/manage_lists.tsx @@ -68,6 +68,10 @@ const ListPickerPage = () => { }; const { allPaths } = data ?? {}; + // Filter out lists where user is a viewer (can't add/remove bookmarks) + const filteredPaths = allPaths?.filter( + (path) => path[path.length - 1].userRole !== "viewer", + ); return ( { )} - data={allPaths} + data={filteredPaths} /> ); diff --git a/apps/web/components/dashboard/lists/BookmarkListSelector.tsx b/apps/web/components/dashboard/lists/BookmarkListSelector.tsx index a267c692..7f916949 100644 --- a/apps/web/components/dashboard/lists/BookmarkListSelector.tsx +++ b/apps/web/components/dashboard/lists/BookmarkListSelector.tsx @@ -46,10 +46,15 @@ export function BookmarkListSelector({ } allPaths = allPaths?.filter((path) => { - if (hideBookmarkIds.includes(path[path.length - 1].id)) { + const lastItem = path[path.length - 1]; + if (hideBookmarkIds.includes(lastItem.id)) { return false; } - if (!listTypes.includes(path[path.length - 1].type)) { + if (!listTypes.includes(lastItem.type)) { + return false; + } + // Hide lists where user is a viewer (can't add/remove bookmarks) + if (lastItem.userRole === "viewer") { return false; } if (!hideSubtreeOf) { -- cgit v1.2.3-70-g09d2