Files
openfoodnetwork/app/models
Greg Austic c72976b1e2 Fix guest order cancellation redirecting to home page
When a guest places an order and tries to cancel it from the order
confirmation page, the cancellation silently failed and redirected
to the home page. The guest was left unsure whether the order was
cancelled, and the hub received no cancellation notification.

Root cause: two missing pieces for guest (token-based) authorization:

1. The `:cancel` ability in Ability#add_shopping_abilities only checked
   `order.user == user`, ignoring the guest token. The `:read` and
   `:update` abilities already support `order.token && token == order.token`
   as a fallback — `:cancel` now does the same.

2. The `cancel` action called `authorize! :cancel, @order` without
   passing `session[:access_token]`, so even with the corrected ability
   the token was never evaluated.

Fixes #13817

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 09:05:47 -04:00
..
2024-09-24 10:43:55 +10:00
2023-09-12 23:19:05 +09:00
2024-02-22 10:15:07 +11:00
2026-03-10 16:07:43 +11:00
2023-09-12 23:19:05 +09:00
2024-04-09 10:44:02 +02:00
2025-03-26 19:44:08 +01:00
2025-11-03 15:50:12 +11:00
2026-03-11 11:09:12 +11:00
2024-11-28 13:35:01 +01:00