From 92b651a8e21fc28ed2153604502b13f07158c371 Mon Sep 17 00:00:00 2001 From: Alberto Vena Date: Tue, 21 Mar 2023 18:25:49 +0100 Subject: [PATCH] Remove deprecated Spree::Order#require_email Please, use Spree::Order#email_required? now. Ref https://github.com/solidusio/solidus/pull/3879 --- core/app/models/spree/order.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/core/app/models/spree/order.rb b/core/app/models/spree/order.rb index f72b5ea4751..c8dc88d6237 100644 --- a/core/app/models/spree/order.rb +++ b/core/app/models/spree/order.rb @@ -767,16 +767,17 @@ def link_by_email self.email = user.email if user end - # Determine if email is required (we don't want validation errors before we hit the checkout) + # Determine if the email is required for this order + # + # We don't require email for orders in the cart state or address state because those states + # precede the entry of an email address. + # + # @return [Boolean] true if the email is required + # @note This method was called require_email before. def email_required? true unless new_record? || ['cart', 'address'].include?(state) end - def require_email - Spree::Deprecation.warn "Use email_required? instead", caller(1) - email_required? - end - def ensure_inventory_units if has_checkout_step?("delivery") inventory_validator = Spree::Config.stock.inventory_validator_class.new