fix(admin-feedback): mask email on detail + no-email indicator + await reply email send #116
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!116
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/feedback-detail-mask-email-and-await-send"
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-94. Stacks on BUNYIP-93.
Two issues on the admin feedback detail subpage after BUNYIP-85 / 92 / 93 shipped:
The "From" line on the detail subpage rendered the submitter's unmasked email. Admins do not need the raw address to reply (the API holds the email and routes the response server-side), and surfacing it on the detail page violates the same masking posture the row list uses.
Replying did not deliver an email to the submitter in at least one case. The API's send_feedback_response is wired and the template exists, but
respond_to_feedbacktokio::spawn'd the email send and returned 200 immediately, so any SMTP / config / template failure landed only in the spawned task's tracing logs - after the request had already returned - and was invisible to anyone tailing API logs by request_id.Changes:
bunyip-web/src/api/types.rs::AdminFeedbackDetail: add
email_masked: Option<String>with serde(default). The API already emits it; bunyip-web just did not bind it.bunyip-web/src/handlers/admin.rs::feedback_detail_view: render
email_maskedinstead ofemailin the identity line. Compute ahas_emailboolean from the raw email so the Response card can warn when the row has no recipient: a small amber banner says "No email on record - the submitter did not provide an address. Your response will be saved but cannot be delivered." Removes the silent failure mode where an admin types a thoughtful reply for a submitter who never gave an email.bunyip-api/src/handlers/feedback.rs::respond_to_feedback: drop the tokio::spawn around
email_service.send_feedback_response(...). Await it directly. On failure, log attracing::error!with the request's request_id, feedback_id, AND recipient (so an admin investigating "why didn't it arrive?" has the exact address that was tried). Continue returning success either way because the response IS saved to DB regardless; the change is purely visibility.The trade-off: the respond request now blocks on SMTP. lettre's transport has its own timeouts so the upper bound is bounded; admins reply at human cadence so the extra latency is invisible. Spawning was useful when email was synchronous and slow; awaiting matches every other email-emit site in this codebase (welcome, invite, password reset).
Out of scope: a richer respond response that surfaces
email_sentto the SSR so the toast reads "Response sent" vs "Response saved (email failed)". Worth doing as a follow-up if logs alone are not enough. The reorder-email-first-then-save approach is also out of scope (cleaner but requires changing the email service signature so the response text doesn't have to live onfeedback.admin_responseat send time).just check-containerclean (modulo the pre-existing test_config_defaults flake on main; 188 other tests pass; fmt + clippy + build clean).#BUNYIP-94