Repository navigation
feat(collections): edit a collection from where you browse it - #1920
Conversation
A collection page offered no way to change the collection, so owners and admins had to find it again on the Collections page or the admin board. Every collection page now puts Edit and a ⋯ menu (Open in, Sync now for synced lists, Delete…) top-right for the collection's owner, and for server collections while acting as admin, never by account role alone. Another profile's shared collection says whose it is and that it's read-only, and `?notice=read-only` explains why an editor link landed on the page. A library's Collections tab links acting admins to Arrange shelves. Delete sends the ETag the page read; a 412 refreshes the collection so the next try sends its current version. Personal sync and delete now share the scope hooks the page uses. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The collection page now caches the same snapshot the editor reads. With the app's two-minute staleTime, clicking Edit soon after opening the page started the editor on that cached copy, so a change made elsewhere in the meantime surfaced only as a 412 on save. The editor now refetches on mount and keeps the read it made, not the cached copy. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d9711aea2d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| }) | ||
| : []; | ||
| const openIn = namedLibraries.length > 1 ? namedLibraries : []; | ||
| const canSync = view?.kind === "synced"; |
There was a problem hiding this comment.
Gate Sync now on collection capabilities
When an imported collection remains visible but the acting account's storage reports imports: false—for example, a legacy collection on a backend without import support—this check still exposes Sync now, and selecting it only produces the API's 501 unsupported response. The existing Collections page deliberately requires capabilities.imports before offering sync; this page should likewise read the personal or admin capability endpoint and hide or disable the action when imports are unavailable.
AGENTS.md reference: AGENTS.md:L251-L252
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 6eec0e5. The page now reads the personal or admin collection capabilities for its scope and shows Sync now only when imports is true, with tests for both scopes.
|
Examined 13 relevant Web task/parent cases; most severe classification: minor change. The affected Web cases have no recorded Web validation build. #195 W7 remains blocked by #1615: this PR adds a detail-page read-only label, but not the sharing switch or Shared with me list. The current
Suggested corrected line: Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
…at/collection-edit-entry-points # Conflicts: # web/src/hooks/queries/collectionScope.ts
…an import A synced list's page showed Sync now even when the scope's capabilities reported imports unavailable, so the action could only answer 501. The page now reads the personal or admin collection capabilities, matching the Collections page. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…hooks The collection page's Edit, Sync now and Delete share useScopeSnapshot, useScopeSync and useScopeDelete with the Collections page, whose hooks are in the launch bundle. With the base branch already near the tolerance, those roughly 150 bytes put the launch bundle over its budget. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Problem
Related issue: #192; supersedes #1689 in part (owner-only collection actions)
Validation tasks: changes #195 W1, W2, W6, W7; changes #194 A1, A2, A3, A4; changes #192 AC2, AC5 (all Not run; #195 W1 needs a walk on a running build before this PR is marked ready)
A collection's page offers no way to change the collection. To edit or delete it, the profile that owns a personal collection has to go back to the Collections page, and an admin has to find a server collection in Admin > Collections. A library's Collections tab has no link to where an admin arranges that library's collections either. This PR puts Edit and a ⋯ menu at the top right of a collection's page for whoever can change it, marks another profile's shared collection as read-only, and gives acting admins an "Arrange shelves" link on a library's Collections tab.
Stacked on #1919 (
refactor(web): share the admin settings save bar).Approach
useIsActingAdmin, never the account role, so a restricted or non-primary profile on an admin account sees a server collection like any other viewer, and its page never reads the admin collection. Until the profile and the collection are known, the page shows neither the actions nor the byline.scope.paths.edit). The ⋯ menu has Open in ▸ when a server collection belongs to more than one library, Sync now for a synced list, and Delete…. Delete asks first inConfirmDialog, sendsIf-Matchwith the ETag the page read, then goes to the library's Collections tab for a server collection or to/collectionsfor a personal one. After a 412 the page shows the error and reads the collection again, so the next try sends the current ETag.?notice=read-onlyand the viewer can't change the collection, the page says "Only Name can change Collection, so you're on its page instead." For a server collection the name is "admins". A later redesign PR sends read-only editor links here./admin/collections?libraryId=N).collectionScope.tsaddsuseScopeSnapshot,useScopeSyncanduseScopeDelete, which the page and the editor share.useDeleteCollectionanduseSyncUserCollectionnow call them, with the same toasts and refreshes as before.smbreakpoint, the actions and the result count stack under the title.Some parts of the redesign mockup wait for later PRs. Viewers of a server collection see no byline, since a server collection has no owner name, and no actions; their Add to my Home comes later. Because Add to my Home doesn't exist yet, the read-only notice leaves out the mockup's "You can still watch it and add it to your Home". Open in ▸ appears only on server collections, because a personal collection has no per-library page. The delete confirmation is plain text for now.
This applies the rule from #1689 by @Tobechukwu-Njoku, that only the profile that created a personal collection gets its actions, to the collection's page, as the maintainer decided for the collections redesign. The Collections page cards that #1689 changes are not touched here. The PR also follows the redesign's default that a shared collection offers its viewers no actions, which leaves #195 W7 as written.
No API change. jellycompat and the Apple and Android clients need no change. The user manual's collections page needs a line on Edit from a collection's page and Arrange shelves on a library's Collections tab. That siloserver.org issue is not filed yet.
Validation
tsc -bandmake test-webpass.If-Matchand where it lands, Cancel sending nothing, and the retry after a 412 sending the new ETag. A hook test covers the editor reading a cached collection again. The tests that expect actions or the notice to appear fail on the base branch.make verify-local-pathspasses. No Go, contract or migration files changed, so the Go and contract checks were not run.imports, as on the Collections page.Risks
web/perf-budget.jsonrises from 321326 to 322419 brotli bytes. The base branch was already about 940 bytes over the old budget, within its tolerance, and the shareduseScopeSnapshot,useScopeSyncanduseScopeDeletehooks add about 150 bytes to the launch bundle, because the Collections page hooks that call them load at launch.Checklist
AI Disclosure
If-Matchand refreshes after a 412. Run against the base branch, the 7 tests that expect actions or the notice failed. It approved with two minor findings. First, the editor could open on the copy the collection's page had cached and then fail Save with a 412; the editor now reads the collection again when it opens, with a test that failed before the change. Second, it flagged a possible flash of the read-only notice for an admin before the profile loads. That was dismissed: the collection page is behind the route guard that requires a selected profile, so it never renders without one.🤖 Generated with Claude Code
Note
Add edit, sync, and delete actions to the collection browse page
CollectionPageActionsto collection pages in Catalog.tsx, with Edit plus a More menu that offers conditional "Open in", "Sync now", and an ETag-guarded delete dialog with confirmation text and post-delete navigation per scope.useCollectionPageAccessin useCollectionPageAccess.ts to resolve manage vs read-only access: acting admins manage server collections, owners manage personal ones, and shared viewers see a read-only callout with the owner's name.useScopeSyncanduseScopeDeletehooks in collectionScope.ts; delete handles 412 conflicts by invalidating queries so a retry uses fresh data.useScopeEditorto always refetch after mount, so a cached React Query snapshot is never used as the editable snapshot without a fresh read.Macroscope summarized 26db612.