fix(feedback): record originating page via ?from= on the feedback launcher (BUNYIP-104) #150

Merged
vas2000-work merged 2 commits from fix/BUNYIP-104-feedback-from into main 2026-06-16 01:41:41 +02:00
Owner

Summary

The feedback launcher rendered a static a href="/feedback", so submitted feedback never recorded which page it came from. This makes the launcher carry the originating page to the feedback form via a ?from= query param.

Approach chosen: client-side (option b)

The launcher (feedback_launcher in bunyip-web/src/views/layout.rs) is shared by all three shells (public_shell, dashboard_shell, admin_shell) and has no server-side access to the request path. Threading the path through every shell + response helper (public_response / dashboard_response / admin_response) + every handler call site (dozens) would be far more invasive than the value warrants.

Instead, the link sets its href client-side via an inline onclick:

this.href='/feedback?from=' + encodeURIComponent(location.pathname + location.search)

This is a single-element change, captures the true full path including query string, and degrades gracefully: the static href="/feedback" remains a no-JS fallback.

Receiving end already wired

No handler changes needed. The /feedback GET handler (bunyip-web/src/handlers/content.rs) already reads ?from= via FeedbackQuery.from, runs it through sanitize_page_path (requires a leading /, max 255 chars), and round-trips it into the hidden page_path input that the POST submits to the API. location.pathname always starts with /, so it passes the sanitizer.

Verification

cargo fmt --all --check and cargo clippy -p bunyip-web --all-targets -- -D warnings both pass in the pinned rust-builder-glibc image.

#BUNYIP-104

## Summary The feedback launcher rendered a static `a href="/feedback"`, so submitted feedback never recorded which page it came from. This makes the launcher carry the originating page to the feedback form via a `?from=` query param. ## Approach chosen: client-side (option b) The launcher (`feedback_launcher` in `bunyip-web/src/views/layout.rs`) is shared by all three shells (`public_shell`, `dashboard_shell`, `admin_shell`) and has no server-side access to the request path. Threading the path through every shell + response helper (`public_response` / `dashboard_response` / `admin_response`) + every handler call site (dozens) would be far more invasive than the value warrants. Instead, the link sets its href client-side via an inline `onclick`: ``` this.href='/feedback?from=' + encodeURIComponent(location.pathname + location.search) ``` This is a single-element change, captures the true full path including query string, and degrades gracefully: the static `href="/feedback"` remains a no-JS fallback. ## Receiving end already wired No handler changes needed. The `/feedback` GET handler (`bunyip-web/src/handlers/content.rs`) already reads `?from=` via `FeedbackQuery.from`, runs it through `sanitize_page_path` (requires a leading `/`, max 255 chars), and round-trips it into the hidden `page_path` input that the POST submits to the API. `location.pathname` always starts with `/`, so it passes the sanitizer. ## Verification `cargo fmt --all --check` and `cargo clippy -p bunyip-web --all-targets -- -D warnings` both pass in the pinned rust-builder-glibc image. #BUNYIP-104
fix(feedback): record originating page via ?from= on the feedback launcher (BUNYIP-104)
All checks were successful
Check / fmt / clippy / build / test (pull_request) Successful in 1m4s
31d0f46408
Set the feedback launcher href client-side via onclick to /feedback?from=<encoded location.pathname+search> so submitted feedback records the page it came from; the /feedback GET handler already sanitizes ?from= into the hidden page_path input, and the static href stays as a no-JS fallback.

#BUNYIP-104

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Merge branch 'main' into fix/BUNYIP-104-feedback-from
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
Check / fmt / clippy / build / test (pull_request) Successful in 1m4s
ff2951a65c
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/bunyip!150
No description provided.