solidus_core 2.11.6 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of solidus_core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree.js.erb +0 -51
- data/app/helpers/spree/store_helper.rb +0 -11
- data/app/mailers/spree/carton_mailer.rb +1 -5
- data/app/models/concerns/spree/active_storage_adapter.rb +2 -0
- data/app/models/concerns/spree/active_storage_adapter/attachment.rb +11 -11
- data/app/models/concerns/spree/adjustment_source.rb +0 -15
- data/app/models/concerns/spree/calculated_adjustments.rb +0 -18
- data/app/models/concerns/spree/soft_deletable.rb +2 -4
- data/app/models/concerns/spree/user_address_book.rb +0 -37
- data/app/models/concerns/spree/user_methods.rb +2 -11
- data/app/models/spree/ability.rb +0 -37
- data/app/models/spree/address.rb +8 -186
- data/app/models/spree/address/name.rb +2 -20
- data/app/models/spree/adjustment.rb +0 -28
- data/app/models/spree/base.rb +0 -35
- data/app/models/spree/calculator.rb +4 -7
- data/app/models/spree/calculator/flexi_rate.rb +0 -5
- data/app/models/spree/country.rb +1 -6
- data/app/models/spree/credit_card.rb +0 -27
- data/app/models/spree/customer_return.rb +1 -4
- data/app/models/spree/image.rb +0 -7
- data/app/models/spree/image/active_storage_attachment.rb +10 -2
- data/app/models/spree/image/paperclip_attachment.rb +1 -1
- data/app/models/spree/inventory_unit.rb +0 -21
- data/app/models/spree/line_item.rb +2 -45
- data/app/models/spree/order.rb +3 -136
- data/app/models/spree/order_cancellations.rb +4 -24
- data/app/models/spree/order_updater.rb +2 -11
- data/app/models/spree/payment.rb +0 -3
- data/app/models/spree/payment/cancellation.rb +1 -1
- data/app/models/spree/payment_create.rb +1 -13
- data/app/models/spree/payment_method.rb +5 -103
- data/app/models/spree/payment_method/bogus_credit_card.rb +13 -9
- data/app/models/spree/payment_method/credit_card.rb +1 -3
- data/app/models/spree/payment_method/simple_bogus_credit_card.rb +4 -4
- data/app/models/spree/product.rb +0 -39
- data/app/models/spree/product/scopes.rb +0 -27
- data/app/models/spree/promotion.rb +2 -6
- data/app/models/spree/promotion/actions/create_adjustment.rb +0 -3
- data/app/models/spree/promotion/actions/create_item_adjustments.rb +0 -3
- data/app/models/spree/promotion/actions/create_quantity_adjustments.rb +0 -3
- data/app/models/spree/promotion/rules/taxon.rb +2 -15
- data/app/models/spree/promotion_action.rb +5 -9
- data/app/models/spree/promotion_code/batch_builder.rb +0 -14
- data/app/models/spree/promotion_rule.rb +4 -0
- data/app/models/spree/refund.rb +0 -50
- data/app/models/spree/reimbursement.rb +3 -41
- data/app/models/spree/reimbursement_performer.rb +2 -8
- data/app/models/spree/reimbursement_type/credit.rb +1 -4
- data/app/models/spree/reimbursement_type/reimbursement_helpers.rb +1 -2
- data/app/models/spree/reimbursement_type/store_credit.rb +1 -4
- data/app/models/spree/return_authorization.rb +1 -4
- data/app/models/spree/return_item.rb +1 -19
- data/app/models/spree/shipment.rb +1 -54
- data/app/models/spree/shipping_method.rb +0 -25
- data/app/models/spree/shipping_rate.rb +0 -2
- data/app/models/spree/state.rb +0 -4
- data/app/models/spree/stock/simple_coordinator.rb +0 -14
- data/app/models/spree/stock/splitter/base.rb +2 -7
- data/app/models/spree/stock_item.rb +1 -7
- data/app/models/spree/store.rb +0 -12
- data/app/models/spree/store_credit_category.rb +0 -32
- data/app/models/spree/tax_calculator/shipping_rate.rb +1 -12
- data/app/models/spree/tax_rate.rb +0 -27
- data/app/models/spree/taxon.rb +0 -11
- data/app/models/spree/taxon/active_storage_attachment.rb +0 -5
- data/app/models/spree/taxon/paperclip_attachment.rb +0 -5
- data/app/models/spree/user_address.rb +0 -5
- data/app/models/spree/variant.rb +1 -45
- data/config/locales/en.yml +0 -8
- data/db/migrate/20180416083007_add_apply_to_all_to_variant_property_rule.rb +1 -1
- data/lib/generators/solidus/install/install_generator.rb +13 -2
- data/lib/generators/solidus/install/templates/config/initializers/spree.rb.tt +3 -39
- data/lib/generators/spree/dummy/dummy_generator.rb +2 -1
- data/lib/generators/spree/dummy/templates/rails/database.yml +6 -1
- data/lib/generators/spree/dummy/templates/rails/storage.yml +3 -0
- data/lib/generators/spree/dummy/templates/rails/test.rb +2 -0
- data/lib/spree/app_configuration.rb +14 -65
- data/lib/spree/core.rb +9 -8
- data/lib/spree/core/class_constantizer.rb +2 -0
- data/lib/spree/core/controller_helpers/auth.rb +1 -14
- data/lib/spree/core/controller_helpers/order.rb +2 -22
- data/lib/spree/core/controller_helpers/payment_parameters.rb +0 -54
- data/lib/spree/core/controller_helpers/pricing.rb +0 -8
- data/lib/spree/core/controller_helpers/strong_parameters.rb +0 -4
- data/lib/spree/core/engine.rb +0 -35
- data/lib/spree/core/environment_extension.rb +0 -9
- data/lib/spree/core/product_filters.rb +0 -40
- data/lib/spree/core/role_configuration.rb +0 -14
- data/lib/spree/core/search/base.rb +0 -26
- data/lib/spree/core/state_machines.rb +2 -11
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/deprecation.rb +1 -1
- data/lib/spree/event.rb +0 -31
- data/lib/spree/event/configuration.rb +0 -5
- data/lib/spree/event/subscriber.rb +0 -18
- data/lib/spree/event/subscriber_registry.rb +3 -1
- data/lib/spree/i18n.rb +0 -22
- data/lib/spree/money.rb +3 -18
- data/lib/spree/permitted_attributes.rb +2 -53
- data/lib/spree/preferences/persistable.rb +23 -0
- data/lib/spree/testing_support/capybara_ext.rb +0 -30
- data/lib/spree/testing_support/controller_requests.rb +0 -82
- data/lib/spree/testing_support/dummy_app.rb +6 -14
- data/lib/spree/testing_support/dummy_app/migrations.rb +0 -3
- data/lib/spree/testing_support/factories/order_factory.rb +0 -1
- data/lib/spree/testing_support/factories/refund_factory.rb +0 -1
- data/lib/spree/testing_support/fixtures/file.txt +1 -0
- data/lib/spree/testing_support/order_walkthrough.rb +0 -3
- data/lib/spree/testing_support/preferences.rb +0 -25
- data/lib/tasks/upgrade.rake +7 -5
- data/solidus_core.gemspec +2 -5
- metadata +9 -48
- data/app/mailers/spree/test_mailer.rb +0 -13
- data/app/models/concerns/spree/user_payment_source.rb +0 -26
- data/app/models/spree/calculator/free_shipping.rb +0 -22
- data/app/models/spree/calculator/percent_per_item.rb +0 -51
- data/app/models/spree/calculator/price_sack.rb +0 -28
- data/app/models/spree/gateway.rb +0 -14
- data/app/models/spree/gateway/bogus.rb +0 -13
- data/app/models/spree/gateway/bogus_simple.rb +0 -13
- data/app/models/spree/order/checkout.rb +0 -244
- data/app/models/spree/order_capturing.rb +0 -50
- data/app/models/spree/promotion_handler/free_shipping.rb +0 -9
- data/lib/generators/spree/install/install_generator.rb +0 -15
- data/lib/solidus/migrations/rename_gateways.rb +0 -41
- data/lib/spree/core/current_store.rb +0 -24
- data/lib/spree/paranoia_deprecations.rb +0 -41
- data/lib/spree/promo/environment.rb +0 -12
- data/lib/spree/testing_support/bar_ability.rb +0 -19
- data/lib/tasks/core.rake +0 -104
- data/lib/tasks/email.rake +0 -12
- data/lib/tasks/migrations/copy_order_bill_address_to_credit_card.rake +0 -119
- data/lib/tasks/migrations/migrate_address_names.rake +0 -158
- data/lib/tasks/migrations/migrate_default_billing_addresses_to_address_book.rake +0 -38
- data/lib/tasks/migrations/migrate_shipping_rate_taxes.rake +0 -22
- data/lib/tasks/migrations/migrate_user_addresses.rake +0 -34
- data/lib/tasks/migrations/rename_gateways.rake +0 -23
- data/lib/tasks/order_capturing.rake +0 -27
data/config/locales/en.yml
CHANGED
@@ -26,8 +26,6 @@ en:
|
|
26
26
|
address2: Street Address (cont'd)
|
27
27
|
city: City
|
28
28
|
company: Company
|
29
|
-
firstname: First Name
|
30
|
-
lastname: Last Name
|
31
29
|
name: Name
|
32
30
|
phone: Phone
|
33
31
|
zipcode: Zip Code
|
@@ -76,7 +74,6 @@ en:
|
|
76
74
|
created_at: Date/Time
|
77
75
|
name: Name
|
78
76
|
number: Return Number
|
79
|
-
pre_tax_total: Pre-Tax Total
|
80
77
|
reimbursement_status: Reimbursement status
|
81
78
|
total: Total
|
82
79
|
total_excluding_vat: Pre-Tax Total
|
@@ -130,8 +127,6 @@ en:
|
|
130
127
|
spree/order/bill_address:
|
131
128
|
address1: Billing address street
|
132
129
|
city: Billing address city
|
133
|
-
firstname: Billing address first name
|
134
|
-
lastname: Billing address last name
|
135
130
|
name: Billing address name
|
136
131
|
phone: Billing address phone
|
137
132
|
state: Billing address state
|
@@ -139,8 +134,6 @@ en:
|
|
139
134
|
spree/order/ship_address:
|
140
135
|
address1: Shipping address street
|
141
136
|
city: Shipping address city
|
142
|
-
firstname: Shipping address first name
|
143
|
-
lastname: Shipping address last name
|
144
137
|
name: Shipping address name
|
145
138
|
phone: Shipping address phone
|
146
139
|
state: Shipping address state
|
@@ -282,7 +275,6 @@ en:
|
|
282
275
|
type: Type
|
283
276
|
spree/return_authorization:
|
284
277
|
amount: Amount
|
285
|
-
pre_tax_total: Pre-Tax Total
|
286
278
|
total_excluding_vat: Pre-Tax Total
|
287
279
|
spree/return_item:
|
288
280
|
acceptance_status: Acceptance Status
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class AddApplyToAllToVariantPropertyRule < ActiveRecord::Migration[5.1]
|
4
|
-
def
|
4
|
+
def change
|
5
5
|
add_column :spree_variant_property_rules, :apply_to_all, :boolean, default: false, null: false
|
6
6
|
change_column :spree_variant_property_rules, :apply_to_all, :boolean, default: true
|
7
7
|
end
|
@@ -15,6 +15,7 @@ module Solidus
|
|
15
15
|
class_option :migrate, type: :boolean, default: true, banner: 'Run Solidus migrations'
|
16
16
|
class_option :seed, type: :boolean, default: true, banner: 'Load seed data (migrations must be run)'
|
17
17
|
class_option :sample, type: :boolean, default: true, banner: 'Load sample data (migrations must be run)'
|
18
|
+
class_option :active_storage, type: :boolean, default: true, banner: 'Install ActiveStorage as image attachments handler for products and taxons'
|
18
19
|
class_option :auto_accept, type: :boolean
|
19
20
|
class_option :user_class, type: :string
|
20
21
|
class_option :admin_email, type: :string
|
@@ -51,6 +52,16 @@ module Solidus
|
|
51
52
|
template 'config/initializers/spree.rb.tt', 'config/initializers/spree.rb'
|
52
53
|
end
|
53
54
|
|
55
|
+
def install_file_attachment
|
56
|
+
if options[:active_storage]
|
57
|
+
say "Installing Active Storage", :green
|
58
|
+
rake 'active_storage:install'
|
59
|
+
else
|
60
|
+
say "Installing Paperclip", :green
|
61
|
+
gsub_file 'config/initializers/spree.rb', "ActiveStorageAttachment", "PaperclipAttachment"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
54
65
|
def additional_tweaks
|
55
66
|
return unless File.exist? 'public/robots.txt'
|
56
67
|
|
@@ -171,10 +182,10 @@ module Solidus
|
|
171
182
|
end
|
172
183
|
|
173
184
|
bundle_cleanly{ run "bundle install" } if @plugins_to_be_installed.any?
|
174
|
-
run "spring stop"
|
185
|
+
run "spring stop" if defined?(Spring)
|
175
186
|
|
176
187
|
@plugin_generators_to_run.each do |plugin_generator_name|
|
177
|
-
generate "#{plugin_generator_name} --skip_migrations=
|
188
|
+
generate "#{plugin_generator_name} --skip_migrations=true"
|
178
189
|
end
|
179
190
|
end
|
180
191
|
|
@@ -10,15 +10,6 @@ Spree.config do |config|
|
|
10
10
|
# from address for transactional emails
|
11
11
|
config.mails_from = "store@example.com"
|
12
12
|
|
13
|
-
# Use combined first and last name attribute in HTML views and API responses
|
14
|
-
config.use_combined_first_and_last_name_in_address = true
|
15
|
-
|
16
|
-
# Use legacy Spree::Order state machine
|
17
|
-
config.use_legacy_order_state_machine = false
|
18
|
-
|
19
|
-
# Use the legacy address' state validation logic
|
20
|
-
config.use_legacy_address_state_validator = false
|
21
|
-
|
22
13
|
# Uncomment to stop tracking inventory levels in the application
|
23
14
|
# config.track_inventory_levels = false
|
24
15
|
|
@@ -27,38 +18,11 @@ Spree.config do |config|
|
|
27
18
|
# any inventory changes.
|
28
19
|
# config.inventory_cache_threshold = 3
|
29
20
|
|
30
|
-
#
|
31
|
-
config.image_attachment_module = 'Spree::Image::
|
32
|
-
config.taxon_attachment_module = 'Spree::Taxon::
|
33
|
-
|
34
|
-
# Disable legacy Solidus custom CanCanCan actions aliases
|
35
|
-
config.use_custom_cancancan_actions = false
|
21
|
+
# Configure adapter for attachments on products and taxons (use ActiveStorageAttachment or PaperclipAttachment)
|
22
|
+
config.image_attachment_module = 'Spree::Image::ActiveStorageAttachment'
|
23
|
+
config.taxon_attachment_module = 'Spree::Taxon::ActiveStorageAttachment'
|
36
24
|
|
37
25
|
# Defaults
|
38
|
-
|
39
|
-
# Set this configuration to `true` to raise an exception when
|
40
|
-
# an order is populated with a line item with a mismatching
|
41
|
-
# currency. The `false` value will just add a validation error
|
42
|
-
# and will be the only behavior accepted in future versions.
|
43
|
-
# See https://github.com/solidusio/solidus/pull/3456 for more info.
|
44
|
-
config.raise_with_invalid_currency = false
|
45
|
-
|
46
|
-
# Set this configuration to false to always redirect the user to
|
47
|
-
# /unauthorized when needed, without trying to redirect them to
|
48
|
-
# their previous location first.
|
49
|
-
config.redirect_back_on_unauthorized = true
|
50
|
-
|
51
|
-
# Set this configuration to `true` to allow promotions
|
52
|
-
# with no associated actions to be considered active for use by customers.
|
53
|
-
# See https://github.com/solidusio/solidus/pull/3749 for more info.
|
54
|
-
config.consider_actionless_promotion_active = false
|
55
|
-
|
56
|
-
# Set this configuration to `false` to avoid running validations when
|
57
|
-
# updating an order. Be careful since you can end up having inconsistent
|
58
|
-
# data in your database turning it on.
|
59
|
-
# See https://github.com/solidusio/solidus/pull/3645 for more info.
|
60
|
-
config.run_order_validations_on_order_updater = true
|
61
|
-
|
62
26
|
# Permission Sets:
|
63
27
|
|
64
28
|
# Uncomment and customize the following line to add custom permission sets
|
@@ -43,7 +43,7 @@ module Spree
|
|
43
43
|
opts[:skip_test] = true
|
44
44
|
opts[:skip_yarn] = true
|
45
45
|
opts[:skip_bootsnap] = true
|
46
|
-
opts[:
|
46
|
+
opts[:skip_javascript] = true
|
47
47
|
|
48
48
|
puts "Generating dummy Rails application..."
|
49
49
|
invoke Rails::Generators::AppGenerator,
|
@@ -55,6 +55,7 @@ module Spree
|
|
55
55
|
@database = options[:database]
|
56
56
|
|
57
57
|
template "rails/database.yml", "#{dummy_path}/config/database.yml", force: true
|
58
|
+
template "rails/storage.yml", "#{dummy_path}/config/storage/test.yml", force: true
|
58
59
|
template "rails/boot.rb", "#{dummy_path}/config/boot.rb", force: true
|
59
60
|
template "rails/application.rb.tt", "#{dummy_path}/config/application.rb", force: true
|
60
61
|
template "rails/routes.rb", "#{dummy_path}/config/routes.rb", force: true
|
@@ -32,6 +32,8 @@ production:
|
|
32
32
|
encoding: utf8
|
33
33
|
<% when 'postgres', 'postgresql' %>
|
34
34
|
<% db_host = ENV['DB_HOST'] -%>
|
35
|
+
<% db_username = ENV['DB_USERNAME'] -%>
|
36
|
+
<% db_password = ENV['DB_PASSWORD'] -%>
|
35
37
|
development:
|
36
38
|
adapter: postgresql
|
37
39
|
database: <%= database_prefix %><%= options[:lib_name] %>_solidus_development
|
@@ -43,7 +45,10 @@ development:
|
|
43
45
|
test:
|
44
46
|
adapter: postgresql
|
45
47
|
database: <%= database_prefix %><%= options[:lib_name] %>_solidus_test
|
46
|
-
username: postgres
|
48
|
+
username: <%= db_username || 'postgres' %>
|
49
|
+
<% unless db_password.blank? %>
|
50
|
+
password: <%= db_password %>
|
51
|
+
<% end %>
|
47
52
|
min_messages: warning
|
48
53
|
<% unless db_host.blank? %>
|
49
54
|
host: <%= db_host %>
|
@@ -29,6 +29,8 @@ Dummy::Application.configure do
|
|
29
29
|
config.action_mailer.delivery_method = :test
|
30
30
|
ActionMailer::Base.default from: "solidus@example.com"
|
31
31
|
|
32
|
+
config.active_storage.service = :test
|
33
|
+
|
32
34
|
# Raise on deprecation warnings
|
33
35
|
if ENV['SOLIDUS_RAISE_DEPRECATIONS'].present?
|
34
36
|
Spree::Deprecation.behavior = :raise
|
@@ -34,10 +34,6 @@ module Spree
|
|
34
34
|
# @return [Boolean] should state/state_name be required (default: +true+)
|
35
35
|
preference :address_requires_state, :boolean, default: true
|
36
36
|
|
37
|
-
# @!attribute [rw] legacy
|
38
|
-
# @return [Boolean] use the legacy address' state validation logic (default: +true+)
|
39
|
-
preference :use_legacy_address_state_validator, :boolean, default: true
|
40
|
-
|
41
37
|
# @!attribute [rw] admin_interface_logo
|
42
38
|
# @return [String] URL of logo used in admin (default: +'logo/solidus.svg'+)
|
43
39
|
preference :admin_interface_logo, :string, default: 'logo/solidus.svg'
|
@@ -111,16 +107,6 @@ module Spree
|
|
111
107
|
# @return [Boolean]
|
112
108
|
preference :billing_address_required, :boolean, default: false
|
113
109
|
|
114
|
-
# @!attribute [rw] binary_inventory_cache
|
115
|
-
# Only invalidate product caches when they change from in stock to out of
|
116
|
-
# stock. By default, caches are invalidated on any change of inventory
|
117
|
-
# quantity. Setting this to true should make operations on inventory
|
118
|
-
# faster.
|
119
|
-
# (default: +false+)
|
120
|
-
# @deprecated - use inventory_cache_threshold instead
|
121
|
-
# @return [Boolean]
|
122
|
-
preference :binary_inventory_cache, :boolean, default: false
|
123
|
-
|
124
110
|
# @!attribute [rw] can_restrict_stock_management
|
125
111
|
# @return [Boolean] Indicates if stock management can be restricted by location
|
126
112
|
preference :can_restrict_stock_management, :boolean, default: false
|
@@ -154,20 +140,11 @@ module Spree
|
|
154
140
|
# @return [Integer] Customer returns to show per-page in the admin (default: +15+)
|
155
141
|
preference :customer_returns_per_page, :integer, default: 15
|
156
142
|
|
157
|
-
# @!attribute [rw] default_country_id
|
158
|
-
# @deprecated Use the default country ISO preference instead
|
159
|
-
# @return [Integer,nil] id of {Spree::Country} to be selected by default in dropdowns (default: nil)
|
160
|
-
preference :default_country_id, :integer
|
161
|
-
|
162
143
|
# @!attribute [rw] default_country_iso
|
163
144
|
# Default customer country ISO code
|
164
145
|
# @return [String] Two-letter ISO code of a {Spree::Country} to assumed as the country of an unidentified customer (default: "US")
|
165
146
|
preference :default_country_iso, :string, default: 'US'
|
166
147
|
|
167
|
-
# @!attribute [rw] use_custom_cancancan_actions
|
168
|
-
# @return [Boolean] Allow to use legacy Solidus custom CanCanCan action aliases (default: +true+)
|
169
|
-
preference :use_custom_cancancan_actions, :boolean, default: true
|
170
|
-
|
171
148
|
# @!attribute [rw] generate_api_key_for_all_roles
|
172
149
|
# @return [Boolean] Allow generating api key automatically for user
|
173
150
|
# at role_user creation for all roles. (default: +false+)
|
@@ -225,23 +202,6 @@ module Spree
|
|
225
202
|
# @return [Integer] Promotions to show per-page in the admin (default: +15+)
|
226
203
|
preference :promotions_per_page, :integer, default: 15
|
227
204
|
|
228
|
-
# @!attribute [rw] disable_actionless_promotion_validation
|
229
|
-
# @return [Boolean] Promotions should have actions associated before being considered active (default: +true+)
|
230
|
-
preference :consider_actionless_promotion_active, :boolean, default: true
|
231
|
-
|
232
|
-
# @!attribute [rw] raise_with_invalid_currency
|
233
|
-
# Whether to raise an exception if trying to set a line item currency
|
234
|
-
# different from the order currency. When false a validation error
|
235
|
-
# is added to the instance instead.
|
236
|
-
# @return [Boolean] (default: +true+)
|
237
|
-
preference :raise_with_invalid_currency, :boolean, default: true
|
238
|
-
|
239
|
-
# @!attribute [rw] redirect_back_on_unauthorized
|
240
|
-
# Whether to try to redirect users back when they try to access
|
241
|
-
# unauthorized routes, before redirect them to /unauthorized.
|
242
|
-
# @return [Boolean] (default: +false+)
|
243
|
-
preference :redirect_back_on_unauthorized, :boolean, default: false
|
244
|
-
|
245
205
|
# @!attribute [rw] require_master_price
|
246
206
|
# @return [Boolean] Require a price on the master variant of a product (default: +true+)
|
247
207
|
preference :require_master_price, :boolean, default: true
|
@@ -268,10 +228,6 @@ module Spree
|
|
268
228
|
# (default: +['IT']+)
|
269
229
|
preference :countries_that_use_nested_subregions, :array, default: ['IT']
|
270
230
|
|
271
|
-
# @!attribute [rw] run_order_validations_on_order_updater
|
272
|
-
# @return [Boolean] Whether to run validation when updating an order with the OrderUpdater
|
273
|
-
preference :run_order_validations_on_order_updater, :boolean, default: false
|
274
|
-
|
275
231
|
# @!attribute [rw] send_core_emails
|
276
232
|
# @return [Boolean] Whether to send transactional emails (default: true)
|
277
233
|
preference :send_core_emails, :boolean, default: true
|
@@ -307,21 +263,6 @@ module Spree
|
|
307
263
|
# @return [] Track on_hand values for variants / products. (default: true)
|
308
264
|
preference :track_inventory_levels, :boolean, default: true
|
309
265
|
|
310
|
-
# @!attribute [rw] use_combined_first_and_last_name_in_address
|
311
|
-
# @return [Boolean] Use Spree::Address combined first and last name in HTML views and
|
312
|
-
# API responses. (default: +false+)
|
313
|
-
preference :use_combined_first_and_last_name_in_address, :boolean, default: false
|
314
|
-
|
315
|
-
# @!attribute [rw] use_legacy_order_state_machine
|
316
|
-
# @return [Boolean] Uses the legacy order state machine from Spree::Order::Checkout
|
317
|
-
# (default: +false+)
|
318
|
-
preference :use_legacy_order_state_machine, :boolean, default: true
|
319
|
-
|
320
|
-
# The legacy_store_credit_category_name allows to control whether the legacy
|
321
|
-
# way of fetching the category should be used.
|
322
|
-
#
|
323
|
-
# @param [Boolean] enable/disable the legacy way of fetching the store category name
|
324
|
-
preference :use_legacy_store_credit_reimbursement_category_name, :boolean, default: true
|
325
266
|
|
326
267
|
# Other configurations
|
327
268
|
|
@@ -496,23 +437,31 @@ module Spree
|
|
496
437
|
|
497
438
|
# Allows switching attachment library for Image
|
498
439
|
#
|
499
|
-
# `Spree::Image::
|
500
|
-
# is the default and provides the
|
440
|
+
# `Spree::Image::ActiveStorageAttachment`
|
441
|
+
# is the default and provides the Active Storage implementation.
|
501
442
|
#
|
502
443
|
# @!attribute [rw] image_attachment_module
|
503
444
|
# @return [Module] a module that can be included into Spree::Image to allow attachments
|
504
445
|
# Enumerable of images adhering to the present_image_class interface
|
505
|
-
class_name_attribute :image_attachment_module, default: 'Spree::Image::
|
446
|
+
class_name_attribute :image_attachment_module, default: 'Spree::Image::ActiveStorageAttachment'
|
447
|
+
|
448
|
+
# @!attribute [rw] allowed_image_mime_types
|
449
|
+
#
|
450
|
+
# Defines which MIME types are allowed for images
|
451
|
+
# `%w(image/jpeg image/jpg image/png image/gif).freeze` is the default.
|
452
|
+
#
|
453
|
+
# @return [Array]
|
454
|
+
class_name_attribute :allowed_image_mime_types, default: %w(image/jpeg image/jpg image/png image/gif).freeze
|
506
455
|
|
507
456
|
# Allows switching attachment library for Taxon
|
508
457
|
#
|
509
|
-
# `Spree::Taxon::
|
510
|
-
# is the default and provides the
|
458
|
+
# `Spree::Taxon::ActiveStorageAttachment`
|
459
|
+
# is the default and provides the Active Storage implementation.
|
511
460
|
#
|
512
461
|
# @!attribute [rw] taxon_attachment_module
|
513
462
|
# @return [Module] a module that can be included into Spree::Taxon to allow attachments
|
514
463
|
# Enumerable of taxons adhering to the present_taxon_class interface
|
515
|
-
class_name_attribute :taxon_attachment_module, default: 'Spree::Taxon::
|
464
|
+
class_name_attribute :taxon_attachment_module, default: 'Spree::Taxon::ActiveStorageAttachment'
|
516
465
|
|
517
466
|
# Allows providing your own class instance for generating order numbers.
|
518
467
|
#
|
data/lib/spree/core.rb
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "action_controller/railtie"
|
4
|
+
require "action_mailer/railtie"
|
5
|
+
require "action_view/railtie"
|
6
|
+
require "active_job/railtie"
|
7
|
+
require "active_model/railtie"
|
8
|
+
require "active_record/railtie"
|
9
|
+
require "active_storage/engine"
|
10
|
+
require "sprockets/railtie"
|
11
|
+
|
4
12
|
require 'acts_as_list'
|
5
13
|
require 'awesome_nested_set'
|
6
14
|
require 'cancan'
|
@@ -9,12 +17,10 @@ require 'kaminari/activerecord'
|
|
9
17
|
require 'mail'
|
10
18
|
require 'monetize'
|
11
19
|
require 'paperclip'
|
12
|
-
require 'paranoia'
|
13
20
|
require 'ransack'
|
14
21
|
require 'state_machines-activerecord'
|
15
22
|
|
16
23
|
require 'spree/deprecation'
|
17
|
-
require 'spree/paranoia_deprecations'
|
18
24
|
|
19
25
|
# This is required because ActiveModel::Validations#invalid? conflicts with the
|
20
26
|
# invalid state of a Payment. In the future this should be removed.
|
@@ -47,9 +53,6 @@ module Spree
|
|
47
53
|
|
48
54
|
module Core
|
49
55
|
class GatewayError < RuntimeError; end
|
50
|
-
|
51
|
-
include ActiveSupport::Deprecation::DeprecatedConstantAccessor
|
52
|
-
deprecate_constant 'DestroyWithOrdersError', ActiveRecord::DeleteRestrictionError, deprecator: Spree::Deprecation
|
53
56
|
end
|
54
57
|
end
|
55
58
|
|
@@ -61,7 +64,6 @@ require 'spree/core/environment_extension'
|
|
61
64
|
require 'spree/core/environment/calculators'
|
62
65
|
require 'spree/core/environment/promotions'
|
63
66
|
require 'spree/core/environment'
|
64
|
-
require 'spree/promo/environment'
|
65
67
|
require 'spree/migrations'
|
66
68
|
require 'spree/migration_helpers'
|
67
69
|
require 'spree/event'
|
@@ -75,7 +77,6 @@ require 'spree/permitted_attributes'
|
|
75
77
|
require 'spree/core/importer'
|
76
78
|
require 'spree/core/permalinks'
|
77
79
|
require 'spree/core/product_duplicator'
|
78
|
-
require 'spree/core/current_store'
|
79
80
|
require 'spree/core/controller_helpers/auth'
|
80
81
|
require 'spree/core/controller_helpers/common'
|
81
82
|
require 'spree/core/controller_helpers/current_host'
|
@@ -22,20 +22,7 @@ module Spree
|
|
22
22
|
class_attribute :unauthorized_redirect
|
23
23
|
self.unauthorized_redirect = -> do
|
24
24
|
flash[:error] = I18n.t('spree.authorization_failure')
|
25
|
-
|
26
|
-
redirect_back(fallback_location: "/unauthorized")
|
27
|
-
else
|
28
|
-
Spree::Deprecation.warn <<-WARN.strip_heredoc, caller
|
29
|
-
Having Spree::Config.redirect_back_on_unauthorized set
|
30
|
-
to `false` is deprecated and will not be supported in Solidus 3.0.
|
31
|
-
|
32
|
-
Please change this configuration to `true` and be sure that your
|
33
|
-
application does not break trying to redirect back when there is
|
34
|
-
an unauthorized access.
|
35
|
-
WARN
|
36
|
-
|
37
|
-
redirect_to "/unauthorized"
|
38
|
-
end
|
25
|
+
redirect_back(fallback_location: "/unauthorized")
|
39
26
|
end
|
40
27
|
|
41
28
|
rescue_from CanCan::AccessDenied do
|
@@ -11,23 +11,8 @@ module Spree
|
|
11
11
|
|
12
12
|
included do
|
13
13
|
helper_method :current_order
|
14
|
-
helper_method :simple_current_order
|
15
14
|
end
|
16
15
|
|
17
|
-
def simple_current_order
|
18
|
-
return @simple_current_order if @simple_current_order
|
19
|
-
|
20
|
-
@simple_current_order = find_order_by_token_or_user
|
21
|
-
|
22
|
-
if @simple_current_order
|
23
|
-
@simple_current_order.last_ip_address = ip_address
|
24
|
-
return @simple_current_order
|
25
|
-
else
|
26
|
-
@simple_current_order = Spree::Order.new(current_order_params)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
deprecate simple_current_order: :current_order, deprecator: Spree::Deprecation
|
30
|
-
|
31
16
|
# The current incomplete order from the guest_token for use in cart and during checkout
|
32
17
|
def current_order(options = {})
|
33
18
|
should_create = options[:create_order_if_necessary] || false
|
@@ -84,16 +69,11 @@ module Spree
|
|
84
69
|
current_order_params.merge(last_ip_address: ip_address)
|
85
70
|
end
|
86
71
|
|
87
|
-
def find_order_by_token_or_user(options = {}
|
72
|
+
def find_order_by_token_or_user(options = {})
|
88
73
|
should_lock = options[:lock] || false
|
89
74
|
|
90
75
|
# Find any incomplete orders for the guest_token
|
91
|
-
|
92
|
-
Spree::Deprecation.warn "The second argument to find_order_by_token_or_user is deprecated, and will be removed in a future version."
|
93
|
-
order = Spree::Order.incomplete.includes(:adjustments).lock(should_lock).find_by(current_order_params)
|
94
|
-
else
|
95
|
-
order = Spree::Order.incomplete.lock(should_lock).find_by(current_order_params)
|
96
|
-
end
|
76
|
+
order = Spree::Order.incomplete.lock(should_lock).find_by(current_order_params)
|
97
77
|
|
98
78
|
# Find any incomplete orders for the current user
|
99
79
|
if order.nil? && try_spree_current_user
|