From 6f3802d7afba6bf8cfa528e16a58de4521db639e Mon Sep 17 00:00:00 2001 From: Edwin Cruz Date: Mon, 15 Jan 2024 13:16:10 -0600 Subject: [PATCH] Use Order#email to show the order's email in new admin `spree_orders` table has the column `email` which stores the email of guest orders or users email for non guest orders. We should use that in the new admin to display the email so that guest orders work as well. (cherry picked from commit 93abf41adaa4df328c7d52f14da92c43d3bdf75a) --- admin/app/components/solidus_admin/orders/index/component.rb | 2 +- admin/spec/features/orders/index_spec.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/admin/app/components/solidus_admin/orders/index/component.rb b/admin/app/components/solidus_admin/orders/index/component.rb index 2c8641926f5..f90e25653b3 100644 --- a/admin/app/components/solidus_admin/orders/index/component.rb +++ b/admin/app/components/solidus_admin/orders/index/component.rb @@ -143,7 +143,7 @@ def customer_column col: { class: "w-[400px]" }, header: :customer, data: ->(order) do - customer_email = order.user&.email + customer_email = order.email content_tag :div, String(customer_email) end } diff --git a/admin/spec/features/orders/index_spec.rb b/admin/spec/features/orders/index_spec.rb index 474edfe9439..45cb7cdc0bf 100644 --- a/admin/spec/features/orders/index_spec.rb +++ b/admin/spec/features/orders/index_spec.rb @@ -11,6 +11,7 @@ visit "/admin/orders" click_on "In Progress" + expect(page).to have_content("admin@example.com") expect(page).to have_content("R123456789") expect(page).to have_content("$19.99") expect(page).to be_axe_clean