Skip to content

fix: media count/search, create-folder, plugin sidebar/prune, save-in-place, viewer scope (#888 #890 #929 #970 #971 #835 #783)#983

Open
lane711 wants to merge 8 commits into
mainfrom
lane711/v3-beta-issue-triage
Open

fix: media count/search, create-folder, plugin sidebar/prune, save-in-place, viewer scope (#888 #890 #929 #970 #971 #835 #783)#983
lane711 wants to merge 8 commits into
mainfrom
lane711/v3-beta-issue-triage

Conversation

@lane711

@lane711 lane711 commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Test plan

  • Media library "All Files (N)" shows real count, not 24
  • Pagination correct beyond page 1
  • Media picker search filters; no panel nesting on keystrokes
  • Create folder succeeds on fresh install (no legacy media table)
  • Disabling a plugin from /admin/plugins removes it from sidebar immediately
  • Removing a plugin from config.plugins.register + cold boot → plugin shows inactive in admin
  • Content edit: Save keeps user on page with success toast; Save & close → list; Publish → stays on page
  • Viewer user: sidebar shows Content + Collections only (no Users, Plugins, Settings)
  • Admin user: all sidebar items visible
  • E2E specs 88-media-library-fixes, 92-media-create-folder, 94-removed-plugin-deactivated, 95-viewer-sidebar-scope pass in CI

🤖 Generated with Claude Code

lane711 and others added 6 commits June 30, 2026 10:48
- MediaDocumentService.list() now runs a parallel COUNT(*) with the
  same WHERE filters and returns `total` in MediaListResult
- Admin media route uses `total` for totalFiles and fixes hasNextPage
  (was capped at page size 24 instead of real library total)
- Media selector search input: add missing `name="search"` attr so the
  typed term is actually sent with the HTMX request
- Add hx-swap="outerHTML" + hx-select="#media-selector-grid" to prevent
  the full panel (search box + grid) from nesting inside the grid on
  each keystroke

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…le (#929)

The /api/media/create-folder handler queried `SELECT COUNT(*) FROM media`
to check for duplicates. On greenfield document-model installs the legacy
`media` table does not exist, causing a D1 error on every folder creation.

Replace the check with a query against `documents` (media_asset type) and
wrap in try/catch so installs mid-migration (table absent) degrade gracefully
rather than hard-erroring. Folders remain virtual in R2 — the check is
advisory only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Singleton menu items (user plugins in config.plugins.register) were
appended to the admin sidebar without checking DB active-status. A plugin
disabled via the admin UI left its document status=inactive but the menu
entry still rendered because only PLUGIN_REGISTRY items were DB-checked.

Fix:
- PluginMenuEntry / ResolvedPluginMenuEntry gain optional `pluginId`
- app.ts tags every singleton menu entry with its parent plugin's id
- plugin-menu middleware queries documents for active status of singleton
  plugin ids (one batch query) and filters inactive plugins out
- Items without a pluginId (legacy/external) continue to render as before

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When a plugin is removed from SonicJSConfig.plugins.register it previously
stayed active in the documents table indefinitely (active-status plugin
documents are never pruned).

Add pruneStaleUserPlugins() called from wireRegisteredPlugins Phase D:
- Queries all active non-core plugin documents (isCore falsy)
- Any whose slug is absent from the current wired-plugin set is deactivated
  (json_set data.status = 'inactive', updated_at bumped)
- Core plugins (isCore = true, bootstrapped by PluginBootstrapService) are
  never pruned; any per-row failure is non-fatal
- Runs fire-and-forget alongside reflectWiredPlugins on first request

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…sh (#835)

Replace the Update / Update & Publish button pair with three actions:

- **Save** (action=save): saves draft, returns inline success banner via HTMX,
  user stays on the edit page
- **Save & close** (action=save_and_close): saves draft, HX-Redirect to the
  content list (or the referrer URL if present)
- **Publish** (action=save_and_publish): saves + publishes, returns inline
  success banner, user stays on the edit page

Cancel still navigates to the content list unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lane711 lane711 changed the title fix: media count, selector search, create-folder, disabled plugin sidebar (#888 #890 #929 #971) fix: media count/search, create-folder, plugin sidebar/prune, save-in-place (#888 #890 #929 #970 #971 #835) Jul 1, 2026
…oles (#783)

Viewer role (default for new users) now sees only Content and Collections.
Editor role sees Content, Collections, Settings but not Users or Plugins.
Admin role unchanged — all items visible.

Both catalyst and v2 layouts updated with consistent role guards.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lane711 lane711 changed the title fix: media count/search, create-folder, plugin sidebar/prune, save-in-place (#888 #890 #929 #970 #971 #835) fix: media count/search, create-folder, plugin sidebar/prune, save-in-place, viewer scope (#888 #890 #929 #970 #971 #835 #783) Jul 1, 2026
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