spree_core 6.0.0.beta1 → 6.0.0.beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/jobs/spree/sample_data/load_job.rb +13 -0
- data/app/models/concerns/spree/acted_by.rb +210 -0
- data/app/models/concerns/spree/actor.rb +51 -0
- data/app/models/concerns/spree/admin_user_methods.rb +48 -17
- data/app/models/concerns/spree/purchase/payment_processing.rb +1 -1
- data/app/models/spree/api_key.rb +5 -3
- data/app/models/spree/catalog.rb +50 -13
- data/app/models/spree/claim.rb +2 -1
- data/app/models/spree/current.rb +41 -13
- data/app/models/spree/exchange.rb +2 -1
- data/app/models/spree/line_item.rb +1 -1
- data/app/models/spree/order.rb +54 -6
- data/app/models/spree/pricing_provider/internal.rb +37 -15
- data/app/models/spree/refund.rb +2 -1
- data/app/models/spree/return.rb +2 -1
- data/app/models/spree/stock_receipt.rb +7 -2
- data/app/models/spree/store.rb +4 -0
- data/app/services/spree/orders/approve.rb +3 -2
- data/app/workflows/spree/orders/cancel.rb +3 -2
- data/app/workflows/spree/refunds/create.rb +1 -1
- data/app/workflows/spree/returns/approve.rb +1 -1
- data/app/workflows/spree/returns/create.rb +2 -2
- data/app/workflows/spree/returns/refund.rb +1 -1
- data/config/locales/en.yml +1 -0
- data/db/migrate/20260916000001_order_operation_actors_polymorphic.rb +30 -0
- data/lib/generators/spree/api_resource/api_resource_generator.rb +63 -5
- data/lib/generators/spree/api_resource/templates/admin_controller.rb.tt +5 -0
- data/lib/generators/spree/api_resource/templates/admin_controller_spec.rb.tt +3 -0
- data/lib/generators/spree/api_resource/templates/store_controller_spec.rb.tt +4 -1
- data/lib/generators/spree/model/model_generator.rb +40 -1
- data/lib/generators/spree/model/templates/create_table_migration.rb.tt +9 -0
- data/lib/generators/spree/model/templates/model.rb.tt +10 -4
- data/lib/spree/core/configuration.rb +25 -25
- data/lib/spree/core/engine.rb +27 -0
- data/lib/spree/core/preferences/runtime_configuration.rb +76 -2
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/core.rb +27 -0
- data/lib/spree/testing_support/factories/user_factory.rb +0 -1
- data/lib/tasks/backfill_actor_types.rake +35 -0
- data/lib/tasks/store_settings.rake +1 -0
- metadata +14 -9
- /data/{app/models → lib}/spree/checkout/default_requirements.rb +0 -0
- /data/{app/models → lib}/spree/checkout/registry.rb +0 -0
- /data/{app/models → lib}/spree/checkout/requirement.rb +0 -0
- /data/{app/models → lib}/spree/checkout/requirements.rb +0 -0
- /data/{app/models → lib}/spree/checkout/step.rb +0 -0
|
@@ -40,23 +40,23 @@ module Spree
|
|
|
40
40
|
# case seller invitations fall back to the dashboard origin.
|
|
41
41
|
preference :seller_panel_url, :string, default: nil, env: 'SPREE_SELLER_PANEL_URL'
|
|
42
42
|
preference :allow_checkout_on_gateway_error, :boolean, default: false, deprecated: 'Nothing reads this in Spree 6 — completion checks whether payments cover the total, so a failed gateway call never completes an order'
|
|
43
|
-
preference :allow_empty_price_amount, :boolean, default: false
|
|
43
|
+
preference :allow_empty_price_amount, :boolean, default: false, env: 'SPREE_ALLOW_EMPTY_PRICE_AMOUNT'
|
|
44
44
|
preference :alternative_shipping_phone, :boolean, default: false, deprecated: 'Nothing reads this in Spree 6'
|
|
45
|
-
preference :always_include_confirm_step, :boolean, default: false
|
|
46
|
-
preference :always_use_translations, :boolean, default: false
|
|
45
|
+
preference :always_include_confirm_step, :boolean, default: false, deprecated: 'Use the always_include_confirm_step preference in the Spree::Store model'
|
|
46
|
+
preference :always_use_translations, :boolean, default: false, env: 'SPREE_ALWAYS_USE_TRANSLATIONS'
|
|
47
47
|
preference :auto_capture, :boolean, default: true, deprecated: 'Set it on the store instead' # automatically capture the credit card (as opposed to just authorize and capture later)
|
|
48
48
|
preference :auto_capture_on_dispatch, :boolean, default: false, deprecated: 'Set it on the store instead' # Captures payment on dispatch rather than at checkout.
|
|
49
49
|
preference :company, :boolean, default: false, deprecated: 'Use the company_field_enabled preference in the Spree::Store model' # Request company field for billing and shipping addr
|
|
50
|
-
preference :credit_to_new_allocation, :boolean, default: false
|
|
51
|
-
preference :disable_migration_check, :boolean, default: false # when turned on disables the startup warning about missing engine migrations
|
|
50
|
+
preference :credit_to_new_allocation, :boolean, default: false, env: 'SPREE_CREDIT_TO_NEW_ALLOCATION'
|
|
51
|
+
preference :disable_migration_check, :boolean, default: false, env: 'SPREE_DISABLE_MIGRATION_CHECK' # when turned on disables the startup warning about missing engine migrations
|
|
52
52
|
preference :disable_sku_validation, :boolean, default: false, deprecated: 'Set it on the store instead' # when turned on disables the built-in SKU uniqueness validation
|
|
53
53
|
preference :disable_store_presence_validation, :boolean, default: false, deprecated: true # when turned off disables Store presence validation for Products and Payment Methods
|
|
54
|
-
preference :events_log_enabled, :boolean, default: true # Log all Spree events to Rails logger
|
|
54
|
+
preference :events_log_enabled, :boolean, default: true, env: 'SPREE_EVENTS_LOG_ENABLED' # Log all Spree events to Rails logger
|
|
55
55
|
preference :expedited_exchanges, :boolean, default: false, deprecated: 'Exchanges are their own record in Spree 6 — see Spree::Exchange and the Exchanges::Fulfill workflow'
|
|
56
56
|
preference :expedited_exchanges_days_window, :integer, default: 14, deprecated: 'Exchanges are their own record in Spree 6 — see Spree::Exchange and the Exchanges::Fulfill workflow'
|
|
57
|
-
preference :geocode_addresses, :boolean, default: true
|
|
58
|
-
preference :images_save_from_url_job_attempts, :integer, default: 5
|
|
59
|
-
preference :max_image_download_size, :integer, default: 20_971_520 # 20 MB in bytes
|
|
57
|
+
preference :geocode_addresses, :boolean, default: true, env: 'SPREE_GEOCODE_ADDRESSES'
|
|
58
|
+
preference :images_save_from_url_job_attempts, :integer, default: 5, env: 'SPREE_IMAGES_SAVE_FROM_URL_JOB_ATTEMPTS'
|
|
59
|
+
preference :max_image_download_size, :integer, default: 20_971_520, env: 'SPREE_MAX_IMAGE_DOWNLOAD_SIZE' # 20 MB in bytes
|
|
60
60
|
|
|
61
61
|
# Preprocessed product image variant sizes at 2x retina resolution.
|
|
62
62
|
# These variants are generated on upload to reduce runtime processing.
|
|
@@ -113,12 +113,12 @@ module Spree
|
|
|
113
113
|
end
|
|
114
114
|
|
|
115
115
|
# Maximum size of an uploaded product video, in bytes.
|
|
116
|
-
preference :max_video_upload_size, :integer, default: 524_288_000 # 500 MB
|
|
116
|
+
preference :max_video_upload_size, :integer, default: 524_288_000, env: 'SPREE_MAX_VIDEO_UPLOAD_SIZE' # 500 MB
|
|
117
117
|
|
|
118
118
|
# Maximum size of a document a seller uploads for an onboarding
|
|
119
119
|
# requirement, in bytes. Small on purpose: these are certificates and
|
|
120
120
|
# registrations, and an unbounded upload is a way to fill a disk.
|
|
121
|
-
preference :max_seller_document_upload_size, :integer, default: 20_971_520 # 20 MB
|
|
121
|
+
preference :max_seller_document_upload_size, :integer, default: 20_971_520, env: 'SPREE_MAX_SELLER_DOCUMENT_UPLOAD_SIZE' # 20 MB
|
|
122
122
|
preference :non_expiring_credit_types, :array, default: [], deprecated: 'Nothing reads this in Spree 6 — store credits no longer carry a category, and expiry lives on Spree::GiftCard'
|
|
123
123
|
preference :products_per_page, :integer, default: 12, deprecated: 'Nothing reads this in Spree 6 — pass per_page to the API instead'
|
|
124
124
|
preference :restock_inventory, :boolean, default: true, deprecated: 'Restocking is decided per line item by Spree::ReturnLineItem#resellable'
|
|
@@ -132,9 +132,9 @@ module Spree
|
|
|
132
132
|
# into failures (what this repo's API test suite runs); 'off' disables.
|
|
133
133
|
preference :store_scope_guard, :string, default: 'log', env: 'SPREE_STORE_SCOPE_GUARD'
|
|
134
134
|
# Tiered cart-expiry reaper (docs/plans/6.0-cart-order-split.md Decision 5)
|
|
135
|
-
preference :guest_cart_expiry_days, :integer, default: 30
|
|
136
|
-
preference :customer_cart_expiry_days, :integer, default: 90
|
|
137
|
-
preference :empty_cart_expiry_hours, :integer, default: 48
|
|
135
|
+
preference :guest_cart_expiry_days, :integer, default: 30, env: 'SPREE_GUEST_CART_EXPIRY_DAYS'
|
|
136
|
+
preference :customer_cart_expiry_days, :integer, default: 90, env: 'SPREE_CUSTOMER_CART_EXPIRY_DAYS'
|
|
137
|
+
preference :empty_cart_expiry_hours, :integer, default: 48, env: 'SPREE_EMPTY_CART_EXPIRY_HOURS'
|
|
138
138
|
preference :show_variant_full_price, :boolean, default: false, deprecated: 'Nothing reads this in Spree 6 — a storefront decides how it renders prices'
|
|
139
139
|
preference :show_products_without_price, :boolean, default: false, deprecated: 'Set it on the store instead'
|
|
140
140
|
preference :tax_using_ship_address, :boolean, default: true, deprecated: 'Set it on the store instead'
|
|
@@ -149,33 +149,33 @@ module Spree
|
|
|
149
149
|
preference :storefront_pages_path, :string, default: 'pages', deprecated: 'Nothing reads this in Spree 6 — storefront routes are owned by the storefront'
|
|
150
150
|
|
|
151
151
|
# coupon codes
|
|
152
|
-
preference :coupon_codes_web_limit, :integer, default: 500 # number of coupon codes to be generated in the web process, more than this will be generated in a background job
|
|
153
|
-
preference :coupon_codes_total_limit, :integer, default: 5000 # the maximum number of coupon codes to be generated
|
|
152
|
+
preference :coupon_codes_web_limit, :integer, default: 500, env: 'SPREE_COUPON_CODES_WEB_LIMIT' # number of coupon codes to be generated in the web process, more than this will be generated in a background job
|
|
153
|
+
preference :coupon_codes_total_limit, :integer, default: 5000, env: 'SPREE_COUPON_CODES_TOTAL_LIMIT' # the maximum number of coupon codes to be generated
|
|
154
154
|
|
|
155
155
|
# password reset
|
|
156
|
-
preference :admin_password_reset_expires_in, :integer, default: 15 # admin password reset token expiration time in minutes
|
|
157
|
-
preference :customer_password_reset_expires_in, :integer, default: 15 # password reset token expiration time in minutes
|
|
156
|
+
preference :admin_password_reset_expires_in, :integer, default: 15, env: 'SPREE_ADMIN_PASSWORD_RESET_EXPIRES_IN' # admin password reset token expiration time in minutes
|
|
157
|
+
preference :customer_password_reset_expires_in, :integer, default: 15, env: 'SPREE_CUSTOMER_PASSWORD_RESET_EXPIRES_IN' # password reset token expiration time in minutes
|
|
158
158
|
|
|
159
159
|
# account lockout
|
|
160
|
-
preference :max_failed_login_attempts, :integer, default: 5 # failed login attempts before an account is locked
|
|
161
|
-
preference :lockout_duration, :integer, default: 1800 # lockout duration in seconds (30 minutes)
|
|
160
|
+
preference :max_failed_login_attempts, :integer, default: 5, env: 'SPREE_MAX_FAILED_LOGIN_ATTEMPTS' # failed login attempts before an account is locked
|
|
161
|
+
preference :lockout_duration, :integer, default: 1800, env: 'SPREE_LOCKOUT_DURATION' # lockout duration in seconds (30 minutes)
|
|
162
162
|
|
|
163
163
|
# password policy
|
|
164
164
|
# NIST 800-63B recommends a length floor with no composition rules (no forced
|
|
165
165
|
# symbols/digits, which push users toward predictable substitutions).
|
|
166
|
-
preference :minimum_password_length, :integer, default: 8
|
|
166
|
+
preference :minimum_password_length, :integer, default: 8, env: 'SPREE_MINIMUM_PASSWORD_LENGTH'
|
|
167
167
|
# bcrypt silently truncates past 72 bytes — without a cap a long passphrase and
|
|
168
168
|
# its 72-byte prefix are the same password. A correctness guard, not policy.
|
|
169
|
-
preference :maximum_password_length, :integer, default: ActiveModel::SecurePassword::MAX_PASSWORD_LENGTH_ALLOWED
|
|
169
|
+
preference :maximum_password_length, :integer, default: ActiveModel::SecurePassword::MAX_PASSWORD_LENGTH_ALLOWED, env: 'SPREE_MAXIMUM_PASSWORD_LENGTH'
|
|
170
170
|
# To replace the policy itself, assign Spree.password_validator — a class,
|
|
171
171
|
# not a preference.
|
|
172
172
|
|
|
173
173
|
# gift cards
|
|
174
|
-
preference :gift_card_batch_web_limit, :integer, default: 500 # number of gift card codes to be generated in the web process, more than this will be generated in a background job
|
|
175
|
-
preference :gift_card_batch_limit, :integer, default: 50_000
|
|
174
|
+
preference :gift_card_batch_web_limit, :integer, default: 500, env: 'SPREE_GIFT_CARD_BATCH_WEB_LIMIT' # number of gift card codes to be generated in the web process, more than this will be generated in a background job
|
|
175
|
+
preference :gift_card_batch_limit, :integer, default: 50_000, env: 'SPREE_GIFT_CARD_BATCH_LIMIT'
|
|
176
176
|
|
|
177
177
|
# imports
|
|
178
|
-
preference :large_import_threshold, :integer, default: 500 # imports with more rows than this skip per-row UI broadcasts and use bulk processing
|
|
178
|
+
preference :large_import_threshold, :integer, default: 500, env: 'SPREE_LARGE_IMPORT_THRESHOLD' # imports with more rows than this skip per-row UI broadcasts and use bulk processing
|
|
179
179
|
|
|
180
180
|
end
|
|
181
181
|
end
|
data/lib/spree/core/engine.rb
CHANGED
|
@@ -45,6 +45,7 @@ module Spree
|
|
|
45
45
|
:reports,
|
|
46
46
|
:translatable_resources,
|
|
47
47
|
:taggable_types,
|
|
48
|
+
:actor_classes,
|
|
48
49
|
:custom_fields,
|
|
49
50
|
:reporting,
|
|
50
51
|
:analytics_events,
|
|
@@ -88,6 +89,12 @@ module Spree
|
|
|
88
89
|
Spree::Deprecation = ActiveSupport::Deprecation.new('6.0', 'Spree')
|
|
89
90
|
end
|
|
90
91
|
|
|
92
|
+
# Runs after initializers so an explicitly assigned preference — which
|
|
93
|
+
# wins over the environment — is never rejected for a stale env var.
|
|
94
|
+
config.after_initialize do
|
|
95
|
+
Spree::Core::Configuration.validate_env!(Spree::Config)
|
|
96
|
+
end
|
|
97
|
+
|
|
91
98
|
# I18n's config lives in fiber/thread-local storage that survives across
|
|
92
99
|
# requests on reused server threads, so a request that never assigns its
|
|
93
100
|
# own locale would render in whatever locale the previous request on the
|
|
@@ -105,6 +112,13 @@ module Spree
|
|
|
105
112
|
app.config.spree.subscribers = []
|
|
106
113
|
end
|
|
107
114
|
|
|
115
|
+
# Seeded before application initializers so an extension registering an
|
|
116
|
+
# actor class has something to append to. The defaults are unioned in
|
|
117
|
+
# after initialization, where Spree.admin_user_class is finally known.
|
|
118
|
+
initializer 'spree.register.actor_classes', before: :load_config_initializers do |app|
|
|
119
|
+
app.config.spree.actor_classes = []
|
|
120
|
+
end
|
|
121
|
+
|
|
108
122
|
initializer 'spree.register.calculators', before: :after_initialize do |app|
|
|
109
123
|
end
|
|
110
124
|
|
|
@@ -525,6 +539,19 @@ module Spree
|
|
|
525
539
|
Spree.customer_class.to_s
|
|
526
540
|
]
|
|
527
541
|
|
|
542
|
+
# Models that may be recorded as having performed an action — the
|
|
543
|
+
# vocabulary an `acted_by` association's `*_type` column is validated
|
|
544
|
+
# against. Extend in an app initializer to register an App or bot
|
|
545
|
+
# class, which must include Spree::Actor:
|
|
546
|
+
# Rails.application.config.spree.actor_classes << 'MyApp::App'.
|
|
547
|
+
#
|
|
548
|
+
# Unioned rather than assigned, so what an initializer registered
|
|
549
|
+
# above survives.
|
|
550
|
+
Rails.application.config.spree.actor_classes |= [
|
|
551
|
+
Spree.admin_user_class.to_s,
|
|
552
|
+
'Spree::ApiKey'
|
|
553
|
+
]
|
|
554
|
+
|
|
528
555
|
Rails.application.config.spree.custom_fields.types = [
|
|
529
556
|
Spree::CustomFields::ShortText,
|
|
530
557
|
Spree::CustomFields::LongText,
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
module Spree
|
|
2
2
|
module Preferences
|
|
3
|
+
# Raised when an environment variable backing a preference holds a value
|
|
4
|
+
# that does not parse as the declared type.
|
|
5
|
+
class InvalidEnvironmentValue < StandardError
|
|
6
|
+
def initialize(variable, value, type, expected = nil)
|
|
7
|
+
article = type == :integer ? 'an' : 'a'
|
|
8
|
+
expected ||= "#{article} #{type}"
|
|
9
|
+
super("#{variable}=#{value.inspect} is not valid for #{article} #{type} setting. Expected #{expected}.")
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
3
13
|
class RuntimeConfiguration
|
|
14
|
+
# Deliberately not ActiveModel::Type::Boolean: it casts "no", "Off" and
|
|
15
|
+
# every unrecognised string — a typo included — to true.
|
|
16
|
+
BOOLEAN_TRUE = %w[true 1 yes on].freeze
|
|
17
|
+
BOOLEAN_FALSE = %w[false 0 no off].freeze
|
|
18
|
+
|
|
4
19
|
def initialize
|
|
5
20
|
load_defaults
|
|
6
21
|
end
|
|
@@ -71,10 +86,12 @@ module Spree
|
|
|
71
86
|
# set in an initializer or at runtime always wins over the
|
|
72
87
|
# environment; the env var only fills an unset preference.
|
|
73
88
|
#
|
|
89
|
+
# @param type [Symbol] declared type, used to coerce the env var
|
|
74
90
|
# @param env [String, nil] environment variable backing this setting
|
|
75
|
-
def preference(name,
|
|
91
|
+
def preference(name, type, default: nil, deprecated: false, env: nil)
|
|
76
92
|
defaults[name] = default
|
|
77
93
|
deprecations[name] = deprecated
|
|
94
|
+
types[name] = type
|
|
78
95
|
env_vars[name] = env if env
|
|
79
96
|
|
|
80
97
|
attr_writer name
|
|
@@ -88,7 +105,12 @@ module Spree
|
|
|
88
105
|
value = instance_variable_get(ivar)
|
|
89
106
|
return value unless value.nil?
|
|
90
107
|
|
|
91
|
-
ENV[env]
|
|
108
|
+
raw = ENV[env]
|
|
109
|
+
return default if raw.nil? || raw.empty?
|
|
110
|
+
|
|
111
|
+
# Memoized into the ivar so coercion runs once per process, not
|
|
112
|
+
# once per read — these sit on the request path.
|
|
113
|
+
instance_variable_set(ivar, self.class.coerce_env(env, raw, type))
|
|
92
114
|
end
|
|
93
115
|
else
|
|
94
116
|
attr_reader name
|
|
@@ -103,10 +125,62 @@ module Spree
|
|
|
103
125
|
@deprecations ||= {}
|
|
104
126
|
end
|
|
105
127
|
|
|
128
|
+
# @return [Hash{Symbol => Symbol}] declared type per preference
|
|
129
|
+
def types
|
|
130
|
+
@types ||= {}
|
|
131
|
+
end
|
|
132
|
+
|
|
106
133
|
# @return [Hash{Symbol => String}] preferences backed by an env var
|
|
107
134
|
def env_vars
|
|
108
135
|
@env_vars ||= {}
|
|
109
136
|
end
|
|
137
|
+
|
|
138
|
+
# Reads every env-backed preference so a malformed value fails at boot
|
|
139
|
+
# rather than on the first request that happens to read it. Reading
|
|
140
|
+
# also memoizes the coerced value, so this doubles as a warm-up.
|
|
141
|
+
#
|
|
142
|
+
# @param instance [RuntimeConfiguration] configuration to validate
|
|
143
|
+
# @raise [Spree::Preferences::InvalidEnvironmentValue]
|
|
144
|
+
# @return [void]
|
|
145
|
+
def validate_env!(instance)
|
|
146
|
+
env_vars.each_key { |name| instance.public_send(name) }
|
|
147
|
+
nil
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Env vars arrive as strings, so an uncoerced `SPREE_X=false` would be
|
|
151
|
+
# the truthy String "false". Coercion is strict: a value that does not
|
|
152
|
+
# parse raises rather than falling back to the default, since a typo'd
|
|
153
|
+
# setting silently reverting is worse than a failed boot.
|
|
154
|
+
#
|
|
155
|
+
# @param variable [String] name of the environment variable
|
|
156
|
+
# @param value [String] raw value read from the environment
|
|
157
|
+
# @param type [Symbol] declared preference type
|
|
158
|
+
# @return [Object] the coerced value
|
|
159
|
+
def coerce_env(variable, value, type)
|
|
160
|
+
case type
|
|
161
|
+
when :boolean then coerce_env_boolean(variable, value)
|
|
162
|
+
when :integer then coerce_env_number(variable, value, type) { Integer(value, 10) }
|
|
163
|
+
when :decimal then coerce_env_number(variable, value, type) { BigDecimal(value) }
|
|
164
|
+
when :array then value.split(',').map(&:strip).reject(&:empty?)
|
|
165
|
+
else value
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
private
|
|
170
|
+
|
|
171
|
+
def coerce_env_boolean(variable, value)
|
|
172
|
+
normalized = value.strip.downcase
|
|
173
|
+
return true if BOOLEAN_TRUE.include?(normalized)
|
|
174
|
+
return false if BOOLEAN_FALSE.include?(normalized)
|
|
175
|
+
|
|
176
|
+
raise InvalidEnvironmentValue.new(variable, value, :boolean, "#{BOOLEAN_TRUE.join(', ')}, #{BOOLEAN_FALSE.join(', ')}")
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def coerce_env_number(variable, value, type)
|
|
180
|
+
yield
|
|
181
|
+
rescue ArgumentError, TypeError
|
|
182
|
+
raise InvalidEnvironmentValue.new(variable, value, type)
|
|
183
|
+
end
|
|
110
184
|
end
|
|
111
185
|
end
|
|
112
186
|
end
|
data/lib/spree/core/version.rb
CHANGED
data/lib/spree/core.rb
CHANGED
|
@@ -625,6 +625,25 @@ module Spree
|
|
|
625
625
|
Rails.application.config.spree.taggable_types = value
|
|
626
626
|
end
|
|
627
627
|
|
|
628
|
+
# Class-name strings for the models that may be recorded as having performed
|
|
629
|
+
# an action — what an `acted_by` association's `*_type` column is allowed to
|
|
630
|
+
# hold. The admin user class and `Spree::ApiKey` ship registered; an
|
|
631
|
+
# extension adds its own App or bot class in an initializer:
|
|
632
|
+
#
|
|
633
|
+
# Spree.actor_classes << 'MyApp::App'
|
|
634
|
+
#
|
|
635
|
+
# A class listed here includes {Spree::Actor}, so a timeline can name it.
|
|
636
|
+
# See docs/plans/6.0-action-actors.md.
|
|
637
|
+
#
|
|
638
|
+
# @return [Array<String>]
|
|
639
|
+
def self.actor_classes
|
|
640
|
+
Rails.application.config.spree.actor_classes
|
|
641
|
+
end
|
|
642
|
+
|
|
643
|
+
def self.actor_classes=(value)
|
|
644
|
+
Rails.application.config.spree.actor_classes = value
|
|
645
|
+
end
|
|
646
|
+
|
|
628
647
|
|
|
629
648
|
# Registry of the Getting Started onboarding tasks shown on the admin
|
|
630
649
|
# dashboard. See {Spree::SetupTasks} for the extension API.
|
|
@@ -903,6 +922,14 @@ require 'spree/reporting'
|
|
|
903
922
|
require 'spree/events'
|
|
904
923
|
require 'spree/store_scope_guard'
|
|
905
924
|
|
|
925
|
+
# Not autoloaded from app/: the registry keeps registered steps in
|
|
926
|
+
# class-level state, which a reload would discard.
|
|
927
|
+
require 'spree/checkout/step'
|
|
928
|
+
require 'spree/checkout/requirement'
|
|
929
|
+
require 'spree/checkout/registry'
|
|
930
|
+
require 'spree/checkout/default_requirements'
|
|
931
|
+
require 'spree/checkout/requirements'
|
|
932
|
+
|
|
906
933
|
require 'spree/core/controller_helpers/store'
|
|
907
934
|
|
|
908
935
|
require 'spree/core/preferences/store'
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
namespace :spree do
|
|
2
|
+
namespace :upgrade do
|
|
3
|
+
desc <<~DESC
|
|
4
|
+
Names the admin user class on every "who did this" row written before
|
|
5
|
+
those associations became polymorphic (Spree 6.0). Rows with an actor id
|
|
6
|
+
and no actor type could only ever have pointed at an admin user, so the
|
|
7
|
+
type is filled in and the transitional reader stops being needed.
|
|
8
|
+
|
|
9
|
+
Runs over whatever each model declares with `acted_by`, so the 6.1
|
|
10
|
+
conversion of the remaining associations reuses this task unchanged.
|
|
11
|
+
Idempotent: a row that already carries a type is skipped.
|
|
12
|
+
DESC
|
|
13
|
+
task backfill_actor_types: :environment do
|
|
14
|
+
actor_type = Spree.admin_user_class.to_s
|
|
15
|
+
total = 0
|
|
16
|
+
|
|
17
|
+
Spree::ActedBy.models.each do |model|
|
|
18
|
+
model.acted_by_associations.each do |name|
|
|
19
|
+
count = model.
|
|
20
|
+
where.not(:"#{name}_id" => nil).
|
|
21
|
+
where(:"#{name}_type" => nil).
|
|
22
|
+
in_batches.
|
|
23
|
+
sum { |batch| batch.update_all(:"#{name}_type" => actor_type) }
|
|
24
|
+
|
|
25
|
+
next if count.zero?
|
|
26
|
+
|
|
27
|
+
total += count
|
|
28
|
+
puts " #{model.table_name}.#{name}: #{count} row(s) set to #{actor_type}."
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
puts total.zero? ? ' Nothing to backfill.' : " Backfilled #{total} actor reference(s)."
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -6,6 +6,7 @@ namespace :spree do
|
|
|
6
6
|
# intent and is never copied.
|
|
7
7
|
MOVED_SETTINGS = {
|
|
8
8
|
address_requires_phone: { default: false },
|
|
9
|
+
always_include_confirm_step: { default: false },
|
|
9
10
|
company: { default: false, store_preference: :company_field_enabled },
|
|
10
11
|
default_stock_reservation_ttl_minutes: { default: 10, store_preference: :stock_reservation_ttl_minutes },
|
|
11
12
|
disable_sku_validation: { default: false },
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.0.0.
|
|
4
|
+
version: 6.0.0.beta2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sean Schofield
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2026-09-
|
|
13
|
+
date: 2026-09-17 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: i18n-tasks
|
|
@@ -670,6 +670,7 @@ files:
|
|
|
670
670
|
- app/jobs/spree/products/refresh_metrics_job.rb
|
|
671
671
|
- app/jobs/spree/products/touch_categories_job.rb
|
|
672
672
|
- app/jobs/spree/products/touch_taxons_job.rb
|
|
673
|
+
- app/jobs/spree/sample_data/load_job.rb
|
|
673
674
|
- app/jobs/spree/search_provider/index_job.rb
|
|
674
675
|
- app/jobs/spree/search_provider/remove_job.rb
|
|
675
676
|
- app/jobs/spree/seller_payouts/sweep_due_job.rb
|
|
@@ -693,6 +694,8 @@ files:
|
|
|
693
694
|
- app/mailers/spree/webhook_mailer.rb
|
|
694
695
|
- app/models/acts_as_taggable_on/tag_decorator.rb
|
|
695
696
|
- app/models/concerns/spree/account_lockout.rb
|
|
697
|
+
- app/models/concerns/spree/acted_by.rb
|
|
698
|
+
- app/models/concerns/spree/actor.rb
|
|
696
699
|
- app/models/concerns/spree/admin_user_methods.rb
|
|
697
700
|
- app/models/concerns/spree/calculated_adjustments.rb
|
|
698
701
|
- app/models/concerns/spree/calculator/currency_amounts.rb
|
|
@@ -824,11 +827,6 @@ files:
|
|
|
824
827
|
- app/models/spree/channel.rb
|
|
825
828
|
- app/models/spree/channel/gating.rb
|
|
826
829
|
- app/models/spree/channel_stock_location.rb
|
|
827
|
-
- app/models/spree/checkout/default_requirements.rb
|
|
828
|
-
- app/models/spree/checkout/registry.rb
|
|
829
|
-
- app/models/spree/checkout/requirement.rb
|
|
830
|
-
- app/models/spree/checkout/requirements.rb
|
|
831
|
-
- app/models/spree/checkout/step.rb
|
|
832
830
|
- app/models/spree/claim.rb
|
|
833
831
|
- app/models/spree/claim_line_item.rb
|
|
834
832
|
- app/models/spree/claim_reason.rb
|
|
@@ -1787,6 +1785,7 @@ files:
|
|
|
1787
1785
|
- db/migrate/20260912120000_index_reporting_lifetime_and_promotion_columns.rb
|
|
1788
1786
|
- db/migrate/20260914000001_add_settlement_to_spree_seller_transfers.rb
|
|
1789
1787
|
- db/migrate/20260914230000_add_store_to_spree_option_types.rb
|
|
1788
|
+
- db/migrate/20260916000001_order_operation_actors_polymorphic.rb
|
|
1790
1789
|
- db/sample_data/channels.rb
|
|
1791
1790
|
- db/sample_data/collections.rb
|
|
1792
1791
|
- db/sample_data/custom_field_definitions.rb
|
|
@@ -1840,6 +1839,11 @@ files:
|
|
|
1840
1839
|
- lib/mobility/plugins/store_based_fallbacks.rb
|
|
1841
1840
|
- lib/spree/analytics.rb
|
|
1842
1841
|
- lib/spree/category_permalink_deduplicator.rb
|
|
1842
|
+
- lib/spree/checkout/default_requirements.rb
|
|
1843
|
+
- lib/spree/checkout/registry.rb
|
|
1844
|
+
- lib/spree/checkout/requirement.rb
|
|
1845
|
+
- lib/spree/checkout/requirements.rb
|
|
1846
|
+
- lib/spree/checkout/step.rb
|
|
1843
1847
|
- lib/spree/core.rb
|
|
1844
1848
|
- lib/spree/core/configuration.rb
|
|
1845
1849
|
- lib/spree/core/controller_helpers/store.rb
|
|
@@ -2052,6 +2056,7 @@ files:
|
|
|
2052
2056
|
- lib/spree/validators.rb
|
|
2053
2057
|
- lib/spree/workflow.rb
|
|
2054
2058
|
- lib/spree_core.rb
|
|
2059
|
+
- lib/tasks/backfill_actor_types.rake
|
|
2055
2060
|
- lib/tasks/backfill_custom_field_definition_stores.rake
|
|
2056
2061
|
- lib/tasks/backfill_import_export_tenancy.rake
|
|
2057
2062
|
- lib/tasks/backfill_library_media_placements.rake
|
|
@@ -2122,9 +2127,9 @@ licenses:
|
|
|
2122
2127
|
- BSD-3-Clause
|
|
2123
2128
|
metadata:
|
|
2124
2129
|
bug_tracker_uri: https://github.com/spree/spree/issues
|
|
2125
|
-
changelog_uri: https://github.com/spree/spree/releases/tag/v6.0.0.
|
|
2130
|
+
changelog_uri: https://github.com/spree/spree/releases/tag/v6.0.0.beta2
|
|
2126
2131
|
documentation_uri: https://docs.spreecommerce.org/
|
|
2127
|
-
source_code_uri: https://github.com/spree/spree/tree/v6.0.0.
|
|
2132
|
+
source_code_uri: https://github.com/spree/spree/tree/v6.0.0.beta2
|
|
2128
2133
|
post_install_message:
|
|
2129
2134
|
rdoc_options: []
|
|
2130
2135
|
require_paths:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|