From e4db9bf2725f1714f273332f0a444ec940aae1a8 Mon Sep 17 00:00:00 2001
From: Mohamed Bassem <me@mbassem.com>
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 <noreply@anthropic.com>
---
 .../src/components/ListsSelector.tsx               | 50 +++++++++++-----------
 1 file changed, 26 insertions(+), 24 deletions(-)

(limited to 'apps/browser-extension/src/components/ListsSelector.tsx')

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 }) {
           <CommandList>
             <CommandEmpty>You don&apos;t have any lists.</CommandEmpty>
             <CommandGroup>
-              {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 (
-                  <CommandItem
-                    key={lastItem.id}
-                    value={lastItem.id}
-                    keywords={[lastItem.name, lastItem.icon]}
-                    onSelect={toggleList}
-                    disabled={currentlyUpdating.has(lastItem.id)}
-                  >
-                    <Check
-                      className={cn(
-                        "mr-2 size-4",
-                        existingListIds.has(lastItem.id)
-                          ? "opacity-100"
-                          : "opacity-0",
-                      )}
-                    />
-                    {path
-                      .map((item) => `${item.icon} ${item.name}`)
-                      .join(" / ")}
-                  </CommandItem>
-                );
-              })}
+                  return (
+                    <CommandItem
+                      key={lastItem.id}
+                      value={lastItem.id}
+                      keywords={[lastItem.name, lastItem.icon]}
+                      onSelect={toggleList}
+                      disabled={currentlyUpdating.has(lastItem.id)}
+                    >
+                      <Check
+                        className={cn(
+                          "mr-2 size-4",
+                          existingListIds.has(lastItem.id)
+                            ? "opacity-100"
+                            : "opacity-0",
+                        )}
+                      />
+                      {path
+                        .map((item) => `${item.icon} ${item.name}`)
+                        .join(" / ")}
+                    </CommandItem>
+                  );
+                })}
             </CommandGroup>
           </CommandList>
         </Command>
-- 
cgit v1.2.3-70-g09d2

