Skip to content

feat(core): per-collection opt-out for the dashboard quick action - #3331

Closed
swissky wants to merge 2 commits into
emdash-cms:mainfrom
swissky:feat/collection-quick-create-opt-out
Closed

swissky wants to merge 2 commits into
emdash-cms:mainfrom
swissky:feat/collection-quick-create-opt-out

Conversation

@swissky

@swissky swissky commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Adds an admin.quickCreate collection setting. When it is false, the admin dashboard does not show that collection's "new entry" quick action. Hidden collections already lose their quick action; this covers collections that stay in the sidebar but should not be created from the dashboard (settings-like singletons, sync logs, imported records).

The setting lives in the existing admin_config JSON next to listColumns, so there is no migration. It is wired through:

  • seed files (collections[].admin.quickCreate, validated as a boolean) and seed export
  • the schema API create/update bodies
  • the admin manifest (only published when false)
  • a "Quick action on the dashboard" switch in the content type editor's Navigation section

The schema API replaces the whole admin object on update. The editor therefore sends admin only when the switch changed, and merges it over the existing config so listColumns is kept. The changeset tells API callers to do the same.

No queries are added: the manifest reads the column it already selects, and nothing runs on logged-out routes.

This is a small feature opened directly by a maintainer, without a separate Discussion.

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation (if applicable). Do not include messages.po changes except in translation PRs — a workflow extracts catalogs on merge to main.
  • I have added and reviewed the user-facing changeset (if this PR changes a published package)
  • New features link to an approved Discussion: https://github.com/emdash-cms/emdash/discussions/...
  • I have included screenshots below if this PR changes the UI

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: Cursor + Claude Opus

Screenshots / test output

The new switch in the content type editor's Navigation section:

Content type editor for Posts. The Navigation section shows the Group field and, below it, a switch labelled "Quick action on the dashboard" with the help text "Shows a button for creating a new entry".

After turning the switch off for Posts and saving, the dashboard header offers only "Page" and "Upload Media":

Admin dashboard header with a "Page" quick action and an "Upload Media" button; there is no quick action for Posts.

Targeted tests: ContentTypeEditor.test.tsx + Dashboard.test.tsx (57 passed), seed/validate.test.ts + runtime/manifest-build.test.ts (86 passed).

@changeset-bot

changeset-bot Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4b6b7ed

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
emdash Minor
@emdash-cms/admin Minor
@emdash-cms/cloudflare Minor
@emdash-cms/plugin-test Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/auth Minor
@emdash-cms/blocks Minor
create-emdash Minor
@emdash-cms/gutenberg-to-portable-text Minor
@emdash-cms/x402 Minor
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@swissky swissky added the bot:review Trigger an emdashbot code review on this PR label Sep 23, 2026

@ascorbic ascorbic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good idea

@emdashbot emdashbot Bot added review/approved Approved; no new commits since and removed bot:review Trigger an emdashbot code review on this PR labels Sep 23, 2026
@swissky swissky added the bot:review Trigger an emdashbot code review on this PR label Sep 23, 2026
@pkg-pr-new

pkg-pr-new Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@3331

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@3331

@emdash-cms/auth-atproto

npm i https://pkg.pr.new/@emdash-cms/auth-atproto@3331

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@3331

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@3331

@emdash-cms/contentful-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/contentful-to-portable-text@3331

emdash

npm i https://pkg.pr.new/emdash@3331

create-emdash

npm i https://pkg.pr.new/create-emdash@3331

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@3331

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@3331

@emdash-cms/plugin-test

npm i https://pkg.pr.new/@emdash-cms/plugin-test@3331

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@3331

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@3331

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@3331

@emdash-cms/registry-loader

npm i https://pkg.pr.new/@emdash-cms/registry-loader@3331

@emdash-cms/registry-moderation

npm i https://pkg.pr.new/@emdash-cms/registry-moderation@3331

@emdash-cms/registry-verification

npm i https://pkg.pr.new/@emdash-cms/registry-verification@3331

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@3331

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@3331

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@3331

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@3331

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@3331

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@3331

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@3331

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@3331

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@3331

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@3331

commit: 4b6b7ed

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a focused, additive feature that solves the right problem: letting visible collections opt out of the dashboard “new entry” quick action without being hidden. The approach fits EmDash’s existing model (JSON admin_config, admin manifest opt-in flags, schema API replace semantics) and does not add queries or touch logged-out routes.

I checked:

  • Content type editor — new quickCreate switch state is correctly defaulted to true, included in hasChanges, disabled for code-defined collections, and merged over existing admin.listColumns on update.
  • Schema/registry — admin.quickCreate is persisted as a boolean in admin_config, parsed safely, and returned through the schema API response shape.
  • Validation — Zod API schemas and seed validation both reject non-boolean quickCreate; seed export already serializes collection.admin, so the new field round-trips.
  • Manifest — quickCreate: false is published only when opt-out is set; the dashboard filters quick actions with quickCreate !== false, preserving the default visible behavior.
  • Tests — New cases cover create-with-opt-out, preserving existing listColumns, dashboard filtering, seed validation, and manifest publishing.
  • Documentation/changeset — The seed-files table and the changeset accurately describe the new setting and the schema API replace semantics.

No blocking issues, logic bugs, or AGENTS.md convention violations found.

@emdashbot emdashbot Bot removed the bot:review Trigger an emdashbot code review on this PR label Sep 23, 2026

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a small, self-contained additive feature that lets collections opt out of the dashboard "new entry" quick action via admin.quickCreate. The implementation follows EmDash conventions and keeps the default behavior intact.

What I checked:

  • Approach: The setting lives in the existing JSON admin_config column, so no migration is needed. It is wired through seed files, the schema API, the admin manifest, and the content type editor. This is the right surface for the feature.
  • Logic: quickCreate === false omits the quick action; undefined keeps the current default (show the action). The editor only sends admin when the switch changed, and merges it over existing config so listColumns survives the full-object update performed by the registry. The manifest only publishes the property when it is false.
  • AGENTS.md conventions:
    • Localization: New UI strings in ContentTypeEditor are wrapped for Lingui.
    • RTL-safe Tailwind: The new switch uses semantic tokens and no directional physical classes.
    • Logged-out query counts: No new queries; the manifest already reads admin_config.
    • Comments: No problematic comments were added.
  • Tests: New tests cover the editor toggle (create and update), dashboard filtering, seed validation, and manifest serialization. They assert observable behavior rather than implementation details.
  • Documentation/changeset: The seed docs row is accurate, and the changeset explains the capability, usage paths, and the admin object replacement caveat.

I found no bugs, regressions, or convention violations. The PR is ready to merge as-is.

@github-actions

Copy link
Copy Markdown
Contributor

Overlapping PRs

This PR modifies files that are also changed by other open PRs:

This may cause merge conflicts or duplicated work. A maintainer will coordinate.

@swissky

swissky commented Sep 28, 2026

Copy link
Copy Markdown
Member Author

Closing this as superseded: #3440 (collection navigation settings) shipped the same admin.quickCreate setting — seed files, schema API, the content type editor toggle and the dashboard filter — and it's released, so nothing here is left over. Thanks for the reviews!

@swissky swissky closed this Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants