Skip to content

fix(admin): edit button silently fails for items in All Content tab#3284

Draft
bokelley wants to merge 1 commit intomainfrom
claude/issue-2692-admin-edit-content-lookup
Draft

fix(admin): edit button silently fails for items in All Content tab#3284
bokelley wants to merge 1 commit intomainfrom
claude/issue-2692-admin-edit-content-lookup

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

Closes #2692

Admin users clicking "Edit" on blog posts in the All Content tab got no response — the button appeared to do nothing across all browsers.

Root cause: editContent(id) searched only myContent (the user's own posts). Items displayed in the All Content tab come from adminContent (a separate array populated by GET /api/admin/content). When the ID wasn't in myContent, the function returned early silently.

Fix: Three changes in editContent:

  1. Fall back to adminContent with String(c.id) === String(id) (matching the type-safe comparison already used in openDetailModal)
  2. When item comes from adminContent, async-fetch the full record from /api/admin/content/:id before opening the modal — the admin list endpoint omits content and tags, which would otherwise render the body editor blank and overwrite the article body on save
  3. Resolve committee slug from item.committee_slug (flat field on admin list items) as fallback to item.collection?.committee_slug (nested shape on myContent items)

Non-breaking justification: Client-side JS fix for a broken UI path; no API, schema, or protocol changes.

Pre-PR review:

  • code-reviewer: approved — all three blockers (missing content field, collection field shape mismatch, ID type coercion) addressed; save path via PUT /api/me/content/:id confirmed admin-permissive at server level
  • internal-tools-strategist: approved — async fetch pattern mirrors openDetailModal; editFromDetailModal path unaffected; no new duplicate pathways

Triage-managed PR. This bot does not currently iterate on review comments or PR conversation threads (only on the source issue). To unblock:

  • Push fixup commits directly: gh pr checkout <num> → fix → push.
  • Or re-trigger: comment /triage execute on the source issue.

See #3121 for context.

Session: https://claude.ai/code/${CLAUDE_CODE_REMOTE_SESSION_ID}


Generated by Claude Code

editContent() looked up items only in myContent; admin items in the
All Content tab come from adminContent, so the find() always returned
undefined and the function returned early. Fix: fall back to adminContent
with String() ID normalization, async-fetch full content/tags from
/api/admin/content/:id (list endpoint omits these fields), and handle
the flat committee_slug field on admin list items vs the nested
collection.committee_slug shape on myContent items.

Closes #2692

https://claude.ai/code/${CLAUDE_CODE_REMOTE_SESSION_ID}
@bokelley bokelley added the claude-triaged Issue has been triaged by the Claude Code triage routine. Remove to re-triage. label Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude-triaged Issue has been triaged by the Claude Code triage routine. Remove to re-triage.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

admin: ability to edit content on website part II

2 participants