Skip to content

feat(collections): edit a collection from where you browse it - #1920

Merged
Quick104 merged 5 commits into
feat/collections-revampfrom
feat/collection-edit-entry-points
Oct 4, 2026
Merged

Quick104 merged 5 commits into
feat/collections-revampfrom
feat/collection-edit-entry-points

Conversation

@Quick104

@Quick104 Quick104 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Edit and ⋯ appear for the profile that created a personal collection, and for a profile acting as admin on a server collection. The check is 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.
  • Edit opens today's editor route for the collection (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 in ConfirmDialog, sends If-Match with the ETag the page read, then goes to the library's Collections tab for a server collection or to /collections for a personal one. After a 412 the page shows the error and reads the collection again, so the next try sends the current ETag.
  • Another profile's shared collection shows "by Name · Read-only" under its title and no actions. When the URL has ?notice=read-only and 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.
  • A library's Collections tab shows "Arrange shelves" to acting admins. It opens Admin > Collections for that library (/admin/collections?libraryId=N).
  • collectionScope.ts adds useScopeSnapshot, useScopeSync and useScopeDelete, which the page and the editor share. useDeleteCollection and useSyncUserCollection now call them, with the same toasts and refreshes as before.
  • The editor now reads the collection again when it opens instead of starting from the copy the collection's page cached, which can be up to two minutes old. Without this, editing a collection that changed elsewhere in that window would fail Save with a 412.
  • Below the sm breakpoint, 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

  • Web: lint (no errors; the changed files add no warnings), format:check, build, budget:check, tsc -b and make test-web pass.
  • Page and component tests cover who gets Edit and ⋯ (the acting admin and the owner, but not a non-primary profile on an admin account, a regular account or a shared viewer), that a profile not acting as admin makes no admin read, the byline, and the read-only notice (only with the URL flag, only for viewers who can't edit). They also cover Open in from the keyboard, Sync now, Delete with If-Match and 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.
  • Checked before and after in headless Chromium against a local build with a seeded database: one admin account with a primary and a non-primary profile, two libraries, a server collection in both, an owned personal collection and a shared one. The acting admin and the owner get Edit and ⋯. The shared viewer sees the byline, and with the URL flag, the notice. The non-primary profile sees no Edit and no Arrange shelves. At phone width the actions sit under the title.
  • make verify-local-paths passes. No Go, contract or migration files changed, so the Go and contract checks were not run.
  • Collections — Web #195 W1 has not been walked on a running build.
  • Sync now on a collection's page appears only when the scope's collection capabilities report imports, as on the Collections page.

Risks

  • A personal collection's page, and a server collection's page for an acting admin, now also read the collection itself (one extra GET) to decide who may change it and to get the ETag for Delete. Delete stays disabled until that read returns.
  • The editor makes one more GET when it opens on a collection whose page was just viewed.
  • web/perf-budget.json rises from 321326 to 322419 brotli bytes. The base branch was already about 940 bytes over the old budget, within its tolerance, and the shared useScopeSnapshot, useScopeSync and useScopeDelete hooks add about 150 bytes to the launch bundle, because the Collections page hooks that call them load at launch.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Claude Code (in T3 Code)
  • Tool(s): Claude Code subagents (implementer, independent reviewer)
  • Model(s): claude-opus-5-5[1m]
  • Involvement: Fully AI-generated, human review pending
  • Adversarial review: An independent reviewer subagent checked the diff against the redesign plan. It confirmed that edit access comes only from acting as admin, never from the account role, that profiles not acting as admin never request the admin collection, and that Delete sends If-Match and 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

  • Adds CollectionPageActions to 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.
  • Adds useCollectionPageAccess in 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.
  • Refactors personal sync and delete onto new shared useScopeSync and useScopeDelete hooks in collectionScope.ts; delete handles 412 conflicts by invalidating queries so a retry uses fresh data.
  • Fixes useScopeEditor to always refetch after mount, so a cached React Query snapshot is never used as the editable snapshot without a fresh read.
  • Adds an admin-only "Arrange shelves" link on library Collections pages in LibraryCollections.tsx.
  • Behavioral Change: raises the eager Brotli budget in perf-budget.json to 322,419 bytes; personal delete and sync now run through the shared scope hooks.

Macroscope summarized 26db612.

Quick104 and others added 2 commits October 4, 2026 11:10
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]>
@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bc3baf56-c852-42b2-b830-45c46d209eef

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-04T20:58:35.678074Z 6eec0e5 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@macroscopeapp

macroscopeapp Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

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 Validation tasks: line omits changed cases and lists #194 A5, whose restricted-member filtering is unchanged. A4 also does not need listing as a change: regular-user exclusion and mutation authorization are untouched.

Task Case Surface Validated build Classification Reason
#195 W1 Web Not run minor change Owner pages add Edit/actions; shared pages gain an owner/read-only byline.
#195 W2 Web Not run minor change Personal pages add Edit/Delete shortcuts; the editor refreshes its snapshot on open.
#195 W6 Web Not run minor change Owners gain a private-edit shortcut; shared/server authoring remains gated.
#195 W7 Web Not run minor change Shared detail pages gain read-only labels; #1615's sharing switch and list remain outstanding.
#194 A1 Web admin Not run minor change Catalog adds Edit/Delete and library tabs gain Arrange shelves; mutation logic is unchanged.
#194 A2 Web admin Not run minor change Catalog adds a route to smart-rule editing; rule matching behavior is unchanged.
#194 A3 Web admin Not run minor change Catalog adds a route to artwork editing; artwork persistence logic is unchanged.
#192 AC1 Parent criterion (Web portion) Not run minor change Collection headers add bylines/actions and use a different responsive layout.
#192 AC2 Parent criterion (Web portion) Not run minor change Collection pages add owner-only controls and shared-viewer read-only labeling.
#192 AC5 Parent criterion (Web admin) Not run minor change Acting admins gain collection-management entry points; mutation logic is unchanged.
#192 AC6 Parent criterion (Web portion) Not run minor change Personal collection pages add owner Edit/Delete shortcuts; create and save behavior is unchanged.
#194 A4 Web admin Not run no behavior change New entry points are acting-admin-only; regular-user exclusion and API authorization are unchanged.
#194 A5 Web admin Not run no behavior change Header access checks do not alter the collection-member filtering query.

Suggested corrected line: Validation tasks: changes #195 W1, W2, W6, W7; changes #194 A1, A2, A3; changes #192 AC1, AC2, AC5, AC6.

Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.

Posted via Macroscope — v1 validation impact

Base automatically changed from refactor/shared-save-bar to feat/collections-revamp October 4, 2026 20:50
Quick104 and others added 2 commits October 4, 2026 16:53
…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]>
@Quick104

Quick104 commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Updated the Validation tasks line to the suggested cases (#195 W1, W2, W6, W7; #194 A1–A4; #192 AC2, AC5) and dropped #194 A5.

…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]>
@Quick104
Quick104 merged commit 2d6c3bf into feat/collections-revamp Oct 4, 2026
15 checks passed
@Quick104
Quick104 deleted the feat/collection-edit-entry-points branch October 4, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant