From cf95b522610b2e1e01b51418fe80eea4ce239c5e 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) # Conflicts: # admin/spec/features/orders/index_spec.rb --- .../solidus_admin/orders/index/component.rb | 2 +- admin/spec/features/orders/index_spec.rb | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 admin/spec/features/orders/index_spec.rb diff --git a/admin/app/components/solidus_admin/orders/index/component.rb b/admin/app/components/solidus_admin/orders/index/component.rb index 6f15d11dd9b..7321db4c0cc 100644 --- a/admin/app/components/solidus_admin/orders/index/component.rb +++ b/admin/app/components/solidus_admin/orders/index/component.rb @@ -74,7 +74,7 @@ def customer_column class_name: "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 new file mode 100644 index 00000000000..77ee070d708 --- /dev/null +++ b/admin/spec/features/orders/index_spec.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe "Orders", type: :feature do + before { sign_in create(:admin_user, email: 'admin@example.com') } + + it "lists orders", :js do + create(:order, number: "R123456789", total: 19.99) + + visit "/admin/orders" + click_on "In Progress" + + expect(page).to have_content("admin@example.com") + end +end