feat(feedback): thread page_path through form + display in admin row + CSV export #106
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
psa-systems/bunyip!106
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/feedback-page-path-and-csv-export"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes BUNYIP-84. First of a planned three-PR feedback parity series.
bunyip-api already supports page_path on submissions (handlers/feedback.rs:123, 204, 244) and ships a CSV export endpoint (handlers/feedback.rs:497-537 routed at routes/admin.rs:116). The SSR layer in bunyip-web simply did not surface either.
page_path threading:
bunyip-web/src/handlers/content.rs::feedback_getnow accepts aQuery<FeedbackQuery>with a single optionalfromfield. When present and sane (starts with/, len <= 255 to match the API validation), it is rendered as a hiddenpage_pathinput on the form so the submit round-trips it to the API. Anything else (open-redirect-shaped, oversize) is silently dropped.parse_feedback_formnow reads thepage_pathfield from the body and falls back to the existing/feedbackdefault when absent. The samesanitize_page_pathhelper rejects malformed values.feedback_postround-trips the captured path back into the rendered form on an error redraw so a typo on the message field does not strip context after the first failed submit.?from=carry-through is a follow-up PR because it requires threadingcurrent_path: &strthroughdashboard_shell/public_shelland updating five call sites.Admin row page_path display:
crates/bunyip-domain/src/models/feedback.rs::AdminFeedbackSummarygains apage_path: Option<String>field, populated byto_admin_summaryfrom the existingFeedback.page_pathcolumn. Forward-compatible: serde defaults toNoneon rolling deploys.bunyip-web/src/api/types.rs::AdminFeedbackSummarymirrors the field with#[serde(default)]so an older API still deserializes.bunyip-web/src/handlers/admin.rs::feedback) shows a small "From: " line under the identity row. The default/feedbackvalue is suppressed (the form's own URL is noise); empty values are suppressed too.CSV export:
feedback_exportatGET /admin/feedback/exportthat mirrors the existingdownload_assetpattern: re-auth viaadmin_guard, forward the session cookie to bunyip-api's/admin/feedback/export, stream the response body back with the upstreamContent-Type/Content-Dispositionso the browser drives the download. 401 forces re-auth; any other non-2xx bounces back to the feedback list so the browser never saves an error blob asfeedback.csv.bunyip-web/src/main.rsnext to the existing feedback routes.just check-containerclean (modulo the pre-existingtest_config_defaultsparallel-env-var flake onmain, unrelated; 188 other tests pass; fmt + clippy + build clean).#BUNYIP-84