Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Correct the include for address security concern so it can override FIELDS_TO_NORMALIZE (#12847)

Łukasz Adamczyk4a4500d33673
diff --git a/core/app/models/spree/address.rb b/core/app/models/spree/address.rb
index f35e158938..0bf3f304d2 100644
--- a/core/app/models/spree/address.rb
+++ b/core/app/models/spree/address.rb
@@ -6,9 +6,6 @@ module Spree
if defined?(Spree::Webhooks::HasWebhooks)
include Spree::Webhooks::HasWebhooks
end
- if defined?(Spree::Security::Addresses)
- include Spree::Security::Addresses
- end
serialize :preferences, type: Hash, coder: YAML, default: {}
@@ -32,6 +29,10 @@ module Spree
EXCLUDED_KEYS_FOR_COMPARISON = %w(id updated_at created_at deleted_at label user_id public_metadata private_metadata)
FIELDS_TO_NORMALIZE = %w(firstname lastname phone alternative_phone company address1 address2 city zipcode)
+ if defined?(Spree::Security::Addresses)
+ include Spree::Security::Addresses
+ end
+
scope :not_deleted, -> { where(deleted_at: nil) }
scope :by_state_name_or_abbr, lambda { |state_name|