Browse Community Interaction

beta · guide · 0.1.0

Edit comments with immutable revisions

Before an edit, the Project Backend verifies its own session, Project Membership, exact resource visibility, and that the current user still controls platform_account_id. MiniCenter then requires a server-side Project Credential with comments:write and matches the Comment's Project Client, author, resource_type, and resource_id. A mismatch returns 422 without revealing which boundary failed.

Shell example
: "${MINICENTER_URL:?set the Sandbox URL}"
: "${MINICENTER_PROJECT_CREDENTIAL:?set a Project Credential}"
: "${MINICENTER_COMMENT_ID:?set a Comment ID}"

curl --fail-with-body -X PUT "${MINICENTER_URL}/api/v1/community/comments/${MINICENTER_COMMENT_ID}" \
  -H "Authorization: Bearer ${MINICENTER_PROJECT_CREDENTIAL}" \
  -H 'Content-Type: application/json' \
  --data '{"platform_account_id":"30000000-0000-4000-8000-000000000003","resource_type":"article","resource_id":"article-42","body":"A clearer comment.","idempotency_key":"article-42-comment-edit-1"}'

Each changed body creates the next immutable revision and returns it with the edited text. The current Comment returned by list APIs carries that revision. Reuse an idempotency_key only for the identical Comment, author, resource, and body: any later replay returns the original revision snapshot and cannot overwrite newer text. Reusing it with changed input returns 422. Sending unchanged text records the request as a no-op and creates neither a revision nor an event.

A changed edit atomically publishes one client-scoped community.comment.edited event. The event contains Comment, parent, resource, revision, and time, but never the author or body. Creation remains revision 1; editing applies equally to top-level Comments and direct replies. A removed Comment cannot be edited. Rich text, attachments, notifications, and public revision-history reads are not included.

Treat body as untrusted UTF-8 text up to 4,000 characters and HTML-escape it when rendering. If the outcome is uncertain, retry with the original key. The current revision, immutable history, request receipt, and durable event commit together or all roll back.