Skip to content

fix(admin): confirmation notices and JSON responses for admin forms - #25

Merged
arsalan-arshad merged 1 commit into
mainfrom
fix/feedback-confirmation
Nov 6, 2026
Merged

arsalan-arshad merged 1 commit into
mainfrom
fix/feedback-confirmation

Conversation

@arsalan-arshad

Copy link
Copy Markdown
Owner

Summary

  • JSON responses for embedded admin forms: Updated all admin POST handlers in app/lib/protocols/routes.js to check Accept: application/json before any form redirect, returning HTTP 200 JSON with { success: true, notice: ..., message: ... } and no 303 redirect.
  • Valid redirect fallback: If a request does not send Accept: application/json (plain non-JS form submit), 303/302 redirects point to legitimate routes (/admin?tab=settings&notice=feedback_saved, /admin?tab=settings&notice=request_sent, /admin?tab=settings&notice=settings_saved, /admin?tab=contacts), never /api/admin.
  • Polaris success notice banners: In app/lib/protocols/admin.js, on successful submission, client script sets allow-listed notice query parameter (feedback_saved, request_sent, settings_saved) and reloads with a fresh session id_token. renderSettingsTab renders a small dismissible .Polaris-Banner--statusSuccess with text escaped. Unknown notice keys render nothing, and user text/email is never placed in the URL query string.
  • Actionable error feedback: On HTTP 400 or 429 errors, the client script displays the server's error message (or 'Too many requests. Please try again later.' for 429) inline via .Polaris-Banner--statusCritical and alert instead of generic 'Action failed'.
  • Tests & Docs: Added unit tests covering JSON responses on urlencoded POSTs and allow-listed notice banner rendering. Updated test counts (581 passed unit tests) across README, BUILD_PLAN, and PROJECT_CONTEXT.

@arsalan-arshad
arsalan-arshad merged commit 37a475c into main Nov 6, 2026
1 check passed
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