Repository navigation
feat(collections): Add to collection never dead-ends - #1947
Conversation
The dialog is about to list only the profile's own manual collections, take initial ticks from contains_item, save each tick at once and offer an inline New collection. These tests describe that; the Add to collection golden drops the acting admin's server collections group on purpose. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Add to collection now lists only the profile's own manual collections, for acting admins too, with each tick read from contains_item and saved at once. A New collection row is always there, and with no manual collection the dialog opens on it, so a title can always go somewhere. If the new collection is made but the title can't be added, the collection is kept and the toast offers Try again (the add only) and Open it. Admins no longer add titles to server collections here; they do it from the collection's editor. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…nd profile wait A failed list read must not look like having no collections, a tick must keep keyboard focus while it saves, and an unknown profile must keep the dialog waiting after the list has loaded. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…d-friendly A failed list read showed "Start your first collection" to profiles that already had collections; it now says the list couldn't load and offers Try again. A saving tick used the disabled prop, which dropped keyboard focus to the body; it now stays focusable with aria-disabled and ignores presses until the save lands. 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: 77dd554bff
ℹ️ 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".
| // Ticks changed in this dialog, ahead of the list's next read. | ||
| const [ticks, setTicks] = useState<ReadonlyMap<string, boolean>>(new Map()); | ||
| const [flash, setFlash] = useState<Flash | null>(null); |
There was a problem hiding this comment.
Reset local ticks when the item changes
When the same open dialog is reused for a different mediaItemId (for example, while navigating between detail items), this ticks map is retained and isTicked gives it precedence over the newly fetched collection.contains value. The checkboxes and collection count can therefore show the previous title's membership until each collection is manually toggled; clear the map or key the panel by the item/profile when those inputs change.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 2772459: the panel is keyed by mediaItemId, so a dialog that moves to another title starts from that title's contains marks. A test covers rerendering the open dialog with a new title.
|
The #193 S1–S3 passes need re-validation after merge. This diff makes the dialog send #195 W2 and #194 A1 are Not run, so no prior pass is at risk; their changed inline-create/add and acting-admin server-collection workflows need first running-build walks. #195 W3 is unaffected: its Suggested fix: Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
…at/add-to-collection-inline # Conflicts: # web/src/lib/collections/copy.ts
An open dialog that moved to another title kept the ticks made for the previous one, so its checkboxes and count showed stale membership. Key the panel by the title so each title starts from the server's marks. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Problem
Related issue: #990, #192
Validation tasks: changes #193 S1–S3 (Pass on builds 927 and 1012; re-validate after merge, since the dialog now reads
GET /api/v2/collections?contains_item=and itscontainsmarks), #195 W2 and #194 A1 (Not run; need a first walk on a running build); #990 ready for human re-test with #195 W2; #192 AC6 remains unvalidatedWhen a profile with no manual collection opens Add to collection on a title, the dialog tells it to "Create one in Collections first" and gives no way to do that from there (#990). The dialog also doesn't show which collections already hold the title. This PR rebuilds the dialog to match the collections redesign. It lists the profile's own manual collections as checkboxes, ticked when a collection already holds the title, and each tick or untick saves at once. A New manual collection row is always there. With no collection yet, the dialog opens on that row: name a collection and the title goes in.
Acting admins no longer see server collections in this dialog. The owner decided the dialog lists only the profile's own collections. Admins add titles to a server collection from that collection's editor, which #1939 added.
Stacked on #1944 (
feat(api): offer only creatable admin templates). It usescontains_itemfrom #1907 and the collection scope adapter from #1914, both lower in the stack.Approach
PERSONAL_SCOPE.isReadOnly. The dialog lists nothing until the current profile is known, so another profile's shared collection never appears. Smart collections and synced lists are left out because they fill themselves. The footnote reads "Only manual collections take titles by hand. Ticking saves right away."GET /api/v2/collections?contains_item=<id>read. Ticking sendsPUT /api/v2/collections/{id}/items/{item_id}and unticking sendsDELETE; the row then shows "Added" or "Removed" for two seconds in a status region. A failed save puts the tick back and shows the error in a toast. While a save runs, the checkbox keeps keyboard focus and ignores further presses.useAddItemToCollectionnow writes only to personal collections. Its "Added to collection" toast is gone, because the row says "Added". The item page passes the title's name to the dialog.Left out against the mockup: the title chip shows the name and an icon, not the poster and year, because the item page passes only the name. The item page's menu entry still reads "Add to Collection". The web sends
contains_itemwithout checking the capability, because the web ships with the server it talks to.No API change. jellycompat reads stored collection items and needs no change. The Apple and Android follow-up draft gets a line to pre-tick their Add to collection from
contains_item. The user manual's Collections page needs lines saying Add to collection can make a collection and lists only your own, and that admins add titles to server collections from the collection's editor; that siloserver.org issue is not filed yet.Validation
perf-budget.json, unchanged),tsc -bandmake test-web(809 files, 7,547 tests) pass./api/v2requests the dialog sends. They cover ticks fromcontains, the tick and untick requests, a failed tick, which collections are listed, the Shared pill, search, the wait for the profile, the load error, keyboard focus during a save, inline create for a regular profile and for an acting admin (personal route, no admin or library-collection reads), a failed PUT after create with Try again and Open it, an open dialog moving to another title (its ticks reset), and Done. They fail against the old dialog.contains_itemread and no per-library reads, and the server-route add golden is removed.make verify-local-paths,verify-route-inventory,verify-offline-routes,verify-scenario-catalogsandverify-settings-bindings-allpass. No Go, contract or migration files changed, so the other Go and contract checks were not run.Risks
Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Rework Add to collection dialog with immediate checkbox toggles and inline creation
containsmarks), instant save on toggle, search, and aDoneaction. Read-only, smart, and other users' collections are excluded; library collections are not offered to acting admins.useCollectionsContainingin collections.ts to fetch the collection list with membership marks for a content ID;useAddItemToCollectionnow always writes to the personal endpoint and no longer supports admin writes. The detail-page action bars pass the item title to the dialog.useAddItemToCollectiondrops itssourceandpositioninputs and removes the admin route branch; any caller relying on the old signature or admin adds will break.Macroscope summarized 2772459.