From e138fb6579a0508a717552f3363618b0adfd502e Mon Sep 17 00:00:00 2001 From: Priec Date: Sat, 20 Jun 2026 13:29:18 +0200 Subject: [PATCH] fix for the cart checkout --- src/controllers/checkout.rs | 4 ++++ src/fixtures/users.yaml | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/controllers/checkout.rs b/src/controllers/checkout.rs index 1b85685..9d64ed4 100644 --- a/src/controllers/checkout.rs +++ b/src/controllers/checkout.rs @@ -132,6 +132,10 @@ async fn checkout_page( "packeta_api_key": settings::get(&ctx, "packeta_api_key").unwrap_or(""), "logged_in_admin": is_admin, "logged_in_customer": is_customer, + // Required by the navbar profile menu (base.html includes it whenever + // logged_in_customer is true); None for admins/guests. + "customer_name": user.as_ref().filter(|_| is_customer).map(|u| u.name.clone()), + "customer_account_type": user.as_ref().filter(|_| is_customer).map(|u| u.account_type.clone()), "profile_filled": profile_filled, // A logged-in customer's account type is fixed; only guests pick it // and may opt to create an account from the order. diff --git a/src/fixtures/users.yaml b/src/fixtures/users.yaml index c8331ba..4b674a2 100644 --- a/src/fixtures/users.yaml +++ b/src/fixtures/users.yaml @@ -6,6 +6,7 @@ api_key: lo-95ec80d7-cb60-4b70-9b4b-9ef74cb88758 name: user1 theme: light + account_type: personal created_at: "2023-11-12T12:34:56.789Z" updated_at: "2023-11-12T12:34:56.789Z" - id: 3 @@ -15,5 +16,6 @@ api_key: lo-153561ca-fa84-4e1b-813a-c62526d0a77e name: user2 theme: light + account_type: personal created_at: "2023-11-12T12:34:56.789Z" updated_at: "2023-11-12T12:34:56.789Z"