solidus_core 2.11.17 → 3.0.0.rc2

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.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree.js.erb +0 -51
  3. data/app/helpers/spree/store_helper.rb +0 -11
  4. data/app/mailers/spree/carton_mailer.rb +1 -5
  5. data/app/models/concerns/spree/active_storage_adapter/attachment.rb +11 -13
  6. data/app/models/concerns/spree/active_storage_adapter.rb +0 -2
  7. data/app/models/concerns/spree/adjustment_source.rb +0 -15
  8. data/app/models/concerns/spree/calculated_adjustments.rb +0 -18
  9. data/app/models/concerns/spree/soft_deletable.rb +2 -4
  10. data/app/models/concerns/spree/user_address_book.rb +0 -37
  11. data/app/models/concerns/spree/user_methods.rb +2 -11
  12. data/app/models/spree/ability.rb +0 -37
  13. data/app/models/spree/address/name.rb +2 -20
  14. data/app/models/spree/address.rb +8 -187
  15. data/app/models/spree/adjustment.rb +0 -28
  16. data/app/models/spree/base.rb +12 -48
  17. data/app/models/spree/calculator/flexi_rate.rb +0 -5
  18. data/app/models/spree/calculator.rb +0 -11
  19. data/app/models/spree/country.rb +1 -6
  20. data/app/models/spree/credit_card.rb +0 -27
  21. data/app/models/spree/customer_return.rb +1 -4
  22. data/app/models/spree/image/active_storage_attachment.rb +2 -10
  23. data/app/models/spree/image/paperclip_attachment.rb +1 -1
  24. data/app/models/spree/image.rb +0 -7
  25. data/app/models/spree/inventory_unit.rb +0 -21
  26. data/app/models/spree/line_item.rb +2 -45
  27. data/app/models/spree/log_entry.rb +1 -74
  28. data/app/models/spree/order.rb +4 -137
  29. data/app/models/spree/order_cancellations.rb +4 -24
  30. data/app/models/spree/order_shipping.rb +9 -6
  31. data/app/models/spree/order_updater.rb +2 -11
  32. data/app/models/spree/payment/cancellation.rb +3 -22
  33. data/app/models/spree/payment.rb +0 -3
  34. data/app/models/spree/payment_create.rb +1 -13
  35. data/app/models/spree/payment_method/bogus_credit_card.rb +9 -13
  36. data/app/models/spree/payment_method/credit_card.rb +1 -3
  37. data/app/models/spree/payment_method/simple_bogus_credit_card.rb +4 -4
  38. data/app/models/spree/payment_method.rb +2 -106
  39. data/app/models/spree/product/scopes.rb +0 -27
  40. data/app/models/spree/product.rb +0 -39
  41. data/app/models/spree/promotion/actions/create_adjustment.rb +0 -3
  42. data/app/models/spree/promotion/actions/create_item_adjustments.rb +0 -3
  43. data/app/models/spree/promotion/actions/create_quantity_adjustments.rb +0 -3
  44. data/app/models/spree/promotion/rules/taxon.rb +2 -15
  45. data/app/models/spree/promotion.rb +2 -6
  46. data/app/models/spree/promotion_action.rb +2 -12
  47. data/app/models/spree/promotion_code/batch_builder.rb +0 -14
  48. data/app/models/spree/promotion_code.rb +2 -2
  49. data/app/models/spree/promotion_rule.rb +0 -4
  50. data/app/models/spree/refund.rb +0 -60
  51. data/app/models/spree/reimbursement.rb +3 -41
  52. data/app/models/spree/reimbursement_performer.rb +2 -8
  53. data/app/models/spree/reimbursement_type/credit.rb +1 -4
  54. data/app/models/spree/reimbursement_type/reimbursement_helpers.rb +1 -2
  55. data/app/models/spree/reimbursement_type/store_credit.rb +1 -4
  56. data/app/models/spree/return_authorization.rb +1 -4
  57. data/app/models/spree/return_item.rb +1 -19
  58. data/app/models/spree/shipment.rb +1 -54
  59. data/app/models/spree/shipping_method.rb +0 -25
  60. data/app/models/spree/shipping_rate.rb +0 -2
  61. data/app/models/spree/state.rb +0 -4
  62. data/app/models/spree/stock/simple_coordinator.rb +1 -20
  63. data/app/models/spree/stock/splitter/base.rb +2 -7
  64. data/app/models/spree/stock_item.rb +1 -7
  65. data/app/models/spree/store.rb +0 -12
  66. data/app/models/spree/store_credit.rb +0 -8
  67. data/app/models/spree/store_credit_category.rb +0 -32
  68. data/app/models/spree/tax_calculator/shipping_rate.rb +1 -12
  69. data/app/models/spree/tax_rate.rb +0 -27
  70. data/app/models/spree/taxon/active_storage_attachment.rb +0 -5
  71. data/app/models/spree/taxon/paperclip_attachment.rb +0 -5
  72. data/app/models/spree/taxon.rb +0 -11
  73. data/app/models/spree/user_address.rb +0 -5
  74. data/app/models/spree/variant.rb +2 -46
  75. data/config/locales/en.yml +0 -8
  76. data/db/migrate/20180416083007_add_apply_to_all_to_variant_property_rule.rb +1 -1
  77. data/lib/generators/solidus/install/install_generator.rb +13 -2
  78. data/lib/generators/solidus/install/templates/config/initializers/spree.rb.tt +3 -39
  79. data/lib/generators/spree/dummy/dummy_generator.rb +2 -1
  80. data/lib/generators/spree/dummy/templates/rails/database.yml +6 -1
  81. data/lib/generators/spree/dummy/templates/rails/storage.yml +3 -0
  82. data/lib/generators/spree/dummy/templates/rails/test.rb +2 -0
  83. data/lib/spree/app_configuration.rb +6 -89
  84. data/lib/spree/core/class_constantizer.rb +2 -0
  85. data/lib/spree/core/controller_helpers/auth.rb +1 -14
  86. data/lib/spree/core/controller_helpers/order.rb +2 -22
  87. data/lib/spree/core/controller_helpers/payment_parameters.rb +0 -54
  88. data/lib/spree/core/controller_helpers/pricing.rb +0 -8
  89. data/lib/spree/core/controller_helpers/strong_parameters.rb +0 -4
  90. data/lib/spree/core/engine.rb +0 -49
  91. data/lib/spree/core/environment_extension.rb +0 -9
  92. data/lib/spree/core/product_filters.rb +0 -40
  93. data/lib/spree/core/role_configuration.rb +0 -14
  94. data/lib/spree/core/search/base.rb +0 -26
  95. data/lib/spree/core/state_machines.rb +2 -11
  96. data/lib/spree/core/validators/email.rb +1 -1
  97. data/lib/spree/core/version.rb +1 -1
  98. data/lib/spree/core.rb +9 -8
  99. data/lib/spree/event/configuration.rb +0 -5
  100. data/lib/spree/event/subscriber.rb +0 -18
  101. data/lib/spree/event/subscriber_registry.rb +3 -1
  102. data/lib/spree/event.rb +0 -31
  103. data/lib/spree/i18n.rb +0 -22
  104. data/lib/spree/money.rb +3 -18
  105. data/lib/spree/permitted_attributes.rb +3 -60
  106. data/lib/spree/testing_support/blacklist_urls.rb +1 -1
  107. data/lib/spree/testing_support/capybara_ext.rb +0 -30
  108. data/lib/spree/testing_support/controller_requests.rb +0 -82
  109. data/lib/spree/testing_support/dummy_app/migrations.rb +0 -3
  110. data/lib/spree/testing_support/dummy_app.rb +6 -16
  111. data/lib/spree/testing_support/factories/order_factory.rb +0 -1
  112. data/lib/spree/testing_support/factories/refund_factory.rb +0 -1
  113. data/lib/spree/testing_support/factories/user_factory.rb +0 -6
  114. data/lib/spree/testing_support/order_walkthrough.rb +0 -3
  115. data/lib/spree/testing_support/preferences.rb +0 -25
  116. data/lib/spree/testing_support.rb +1 -1
  117. data/lib/tasks/migrations/migrate_default_billing_addresses_to_address_book.rake +20 -15
  118. data/solidus_core.gemspec +1 -25
  119. metadata +9 -94
  120. data/app/mailers/spree/test_mailer.rb +0 -13
  121. data/app/models/concerns/spree/user_payment_source.rb +0 -26
  122. data/app/models/spree/calculator/free_shipping.rb +0 -22
  123. data/app/models/spree/calculator/percent_per_item.rb +0 -51
  124. data/app/models/spree/calculator/price_sack.rb +0 -28
  125. data/app/models/spree/gateway/bogus.rb +0 -13
  126. data/app/models/spree/gateway/bogus_simple.rb +0 -13
  127. data/app/models/spree/gateway.rb +0 -14
  128. data/app/models/spree/order/checkout.rb +0 -244
  129. data/app/models/spree/order_capturing.rb +0 -50
  130. data/app/models/spree/promotion_handler/free_shipping.rb +0 -9
  131. data/lib/generators/spree/install/install_generator.rb +0 -15
  132. data/lib/solidus/migrations/rename_gateways.rb +0 -41
  133. data/lib/spree/core/current_store.rb +0 -24
  134. data/lib/spree/paranoia_deprecations.rb +0 -41
  135. data/lib/spree/preferences/persistable.rb +0 -23
  136. data/lib/spree/promo/environment.rb +0 -12
  137. data/lib/spree/testing_support/bar_ability.rb +0 -19
  138. data/lib/spree/testing_support/fixtures/file.txt +0 -1
  139. data/lib/tasks/core.rake +0 -104
  140. data/lib/tasks/email.rake +0 -12
  141. data/lib/tasks/migrations/copy_order_bill_address_to_credit_card.rake +0 -119
  142. data/lib/tasks/migrations/migrate_shipping_rate_taxes.rake +0 -22
  143. data/lib/tasks/migrations/migrate_user_addresses.rake +0 -34
  144. data/lib/tasks/migrations/rename_gateways.rake +0 -23
  145. data/lib/tasks/order_capturing.rake +0 -27
  146. data/lib/tasks/solidus/check_orders_with_invalid_email.rake +0 -18
@@ -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" if defined?(Spring)
185
+ run "spring stop"
175
186
 
176
187
  @plugin_generators_to_run.each do |plugin_generator_name|
177
- generate "#{plugin_generator_name} --skip_migrations=false"
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
- # Enable Paperclip adapter for attachments on images and taxons
31
- config.image_attachment_module = 'Spree::Image::PaperclipAttachment'
32
- config.taxon_attachment_module = 'Spree::Taxon::PaperclipAttachment'
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[:skip_webpack_install] = true
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 %>
@@ -0,0 +1,3 @@
1
+ test:
2
+ service: Disk
3
+ root: <%= File.expand_path("#{dummy_path}/tmp/storage", destination_root) %>
@@ -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+)
@@ -188,22 +165,6 @@ module Spree
188
165
  # @return [String] URL of logo used on frontend (default: +'logo/solidus.svg'+)
189
166
  preference :logo, :string, default: 'logo/solidus.svg'
190
167
 
191
- # @!attribute [rw] log_entry_permitted_classes
192
- # @return [Array<String>] An array of extra classes that are allowed to be
193
- # loaded from a serialized YAML as details in {Spree::LogEntry}
194
- # (defaults to a non-frozen empty array, so that extensions can add
195
- # their own classes).
196
- # @example
197
- # config.log_entry_permitted_classes = ['Date']
198
- preference :log_entry_permitted_classes, :array, default: []
199
-
200
- # @!attribute [rw] log_entry_allow_aliases
201
- # @return [Boolean] Whether YAML aliases are allowed when loading
202
- # serialized data in {Spree::LogEntry}. It defaults to true. Depending
203
- # on the source of your data, you may consider disabling it to prevent
204
- # entity expansion attacks.
205
- preference :log_entry_allow_aliases, :boolean, default: true
206
-
207
168
  # @!attribute [rw] mails_from
208
169
  # @return [String] Email address used as +From:+ field in transactional emails.
209
170
  preference :mails_from, :string, default: 'solidus@example.com'
@@ -241,23 +202,6 @@ module Spree
241
202
  # @return [Integer] Promotions to show per-page in the admin (default: +15+)
242
203
  preference :promotions_per_page, :integer, default: 15
243
204
 
244
- # @!attribute [rw] disable_actionless_promotion_validation
245
- # @return [Boolean] Promotions should have actions associated before being considered active (default: +true+)
246
- preference :consider_actionless_promotion_active, :boolean, default: true
247
-
248
- # @!attribute [rw] raise_with_invalid_currency
249
- # Whether to raise an exception if trying to set a line item currency
250
- # different from the order currency. When false a validation error
251
- # is added to the instance instead.
252
- # @return [Boolean] (default: +true+)
253
- preference :raise_with_invalid_currency, :boolean, default: true
254
-
255
- # @!attribute [rw] redirect_back_on_unauthorized
256
- # Whether to try to redirect users back when they try to access
257
- # unauthorized routes, before redirect them to /unauthorized.
258
- # @return [Boolean] (default: +false+)
259
- preference :redirect_back_on_unauthorized, :boolean, default: false
260
-
261
205
  # @!attribute [rw] require_master_price
262
206
  # @return [Boolean] Require a price on the master variant of a product (default: +true+)
263
207
  preference :require_master_price, :boolean, default: true
@@ -284,10 +228,6 @@ module Spree
284
228
  # (default: +['IT']+)
285
229
  preference :countries_that_use_nested_subregions, :array, default: ['IT']
286
230
 
287
- # @!attribute [rw] run_order_validations_on_order_updater
288
- # @return [Boolean] Whether to run validation when updating an order with the OrderUpdater
289
- preference :run_order_validations_on_order_updater, :boolean, default: false
290
-
291
231
  # @!attribute [rw] send_core_emails
292
232
  # @return [Boolean] Whether to send transactional emails (default: true)
293
233
  preference :send_core_emails, :boolean, default: true
@@ -323,21 +263,6 @@ module Spree
323
263
  # @return [] Track on_hand values for variants / products. (default: true)
324
264
  preference :track_inventory_levels, :boolean, default: true
325
265
 
326
- # @!attribute [rw] use_combined_first_and_last_name_in_address
327
- # @return [Boolean] Use Spree::Address combined first and last name in HTML views and
328
- # API responses. (default: +false+)
329
- preference :use_combined_first_and_last_name_in_address, :boolean, default: false
330
-
331
- # @!attribute [rw] use_legacy_order_state_machine
332
- # @return [Boolean] Uses the legacy order state machine from Spree::Order::Checkout
333
- # (default: +false+)
334
- preference :use_legacy_order_state_machine, :boolean, default: true
335
-
336
- # The legacy_store_credit_category_name allows to control whether the legacy
337
- # way of fetching the category should be used.
338
- #
339
- # @param [Boolean] enable/disable the legacy way of fetching the store category name
340
- preference :use_legacy_store_credit_reimbursement_category_name, :boolean, default: true
341
266
 
342
267
  # Other configurations
343
268
 
@@ -512,31 +437,23 @@ module Spree
512
437
 
513
438
  # Allows switching attachment library for Image
514
439
  #
515
- # `Spree::Image::PaperclipAttachment`
516
- # is the default and provides the classic Paperclip implementation.
440
+ # `Spree::Image::ActiveStorageAttachment`
441
+ # is the default and provides the Active Storage implementation.
517
442
  #
518
443
  # @!attribute [rw] image_attachment_module
519
444
  # @return [Module] a module that can be included into Spree::Image to allow attachments
520
445
  # Enumerable of images adhering to the present_image_class interface
521
- class_name_attribute :image_attachment_module, default: 'Spree::Image::PaperclipAttachment'
522
-
523
- # @!attribute [rw] allowed_image_mime_types
524
- #
525
- # Defines which MIME types are allowed for images
526
- # `%w(image/jpeg image/jpg image/png image/gif).freeze` is the default.
527
- #
528
- # @return [Array]
529
- class_name_attribute :allowed_image_mime_types, default: %w(image/jpeg image/jpg image/png image/gif).freeze
446
+ class_name_attribute :image_attachment_module, default: 'Spree::Image::ActiveStorageAttachment'
530
447
 
531
448
  # Allows switching attachment library for Taxon
532
449
  #
533
- # `Spree::Taxon::PaperclipAttachment`
534
- # is the default and provides the classic Paperclip implementation.
450
+ # `Spree::Taxon::ActiveStorageAttachment`
451
+ # is the default and provides the Active Storage implementation.
535
452
  #
536
453
  # @!attribute [rw] taxon_attachment_module
537
454
  # @return [Module] a module that can be included into Spree::Taxon to allow attachments
538
455
  # Enumerable of taxons adhering to the present_taxon_class interface
539
- class_name_attribute :taxon_attachment_module, default: 'Spree::Taxon::PaperclipAttachment'
456
+ class_name_attribute :taxon_attachment_module, default: 'Spree::Taxon::ActiveStorageAttachment'
540
457
 
541
458
  # Allows providing your own class instance for generating order numbers.
542
459
  #
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support/core_ext/module'
4
+
3
5
  module Spree
4
6
  module Core
5
7
  module ClassConstantizer
@@ -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
- if Spree::Config.redirect_back_on_unauthorized
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 = {}, with_adjustments = false)
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
- if with_adjustments
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
@@ -64,60 +64,6 @@ module Spree
64
64
  params
65
65
  end
66
66
 
67
- # This method handles the awkwardness of how the html forms are currently
68
- # set up for frontend.
69
- #
70
- # This method expects a params hash in the format of:
71
- #
72
- # {
73
- # order: {
74
- # existing_card: '123',
75
- # ...other params...
76
- # },
77
- # cvc_confirm: '456', # optional
78
- # ...other params...
79
- # }
80
- #
81
- # And this method modifies the params into the format of:
82
- #
83
- # {
84
- # order: {
85
- # payments_attributes: [
86
- # {
87
- # source_attributes: {
88
- # existing_card_id: '123',
89
- # verification_value: '456',
90
- # },
91
- # },
92
- # ]
93
- # ...other params...
94
- # },
95
- # ...other params...
96
- # }
97
- #
98
- def move_existing_card_into_payments_attributes(params)
99
- return params if params[:order].blank?
100
-
101
- card_id = params[:order][:existing_card].presence
102
- cvc_confirm = params[:cvc_confirm].presence
103
-
104
- return params if card_id.nil?
105
-
106
- params[:order][:payments_attributes] = [
107
- {
108
- source_attributes: {
109
- existing_card_id: card_id,
110
- verification_value: cvc_confirm
111
- }
112
- }
113
- ]
114
-
115
- params[:order].delete(:existing_card)
116
- params.delete(:cvc_confirm)
117
-
118
- params
119
- end
120
-
121
67
  # This method handles the awkwardness of how the html forms are currently
122
68
  # set up for frontend.
123
69
  #
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spree/deprecation'
4
-
5
3
  module Spree
6
4
  module Core
7
5
  module ControllerHelpers
@@ -9,18 +7,12 @@ module Spree
9
7
  extend ActiveSupport::Concern
10
8
 
11
9
  included do
12
- helper_method :current_currency
13
10
  helper_method :current_pricing_options
14
11
  end
15
12
 
16
13
  def current_pricing_options
17
14
  Spree::Config.pricing_options_class.from_context(self)
18
15
  end
19
-
20
- def current_currency
21
- current_pricing_options.currency
22
- end
23
- deprecate current_currency: :current_pricing_options, deprecator: Spree::Deprecation
24
16
  end
25
17
  end
26
18
  end
@@ -30,10 +30,6 @@ module Spree
30
30
  ]
31
31
  end
32
32
 
33
- def permitted_checkout_attributes
34
- permitted_attributes.checkout_attributes
35
- end
36
-
37
33
  def permitted_checkout_address_attributes
38
34
  permitted_attributes.checkout_address_attributes
39
35
  end
@@ -15,12 +15,6 @@ module Spree
15
15
  generator.test_framework :rspec
16
16
  end
17
17
 
18
- if ActiveRecord.respond_to?(:yaml_column_permitted_classes) || ActiveRecord::Base.respond_to?(:yaml_column_permitted_classes)
19
- config.active_record.yaml_column_permitted_classes ||= []
20
- config.active_record.yaml_column_permitted_classes |=
21
- [Symbol, BigDecimal, ActiveSupport::HashWithIndifferentAccess]
22
- end
23
-
24
18
  initializer "spree.environment", before: :load_config_initializers do |app|
25
19
  app.config.spree = Spree::Config.environment
26
20
  end
@@ -62,41 +56,6 @@ module Spree
62
56
  end
63
57
 
64
58
  config.after_initialize do
65
- if Spree::Config.raise_with_invalid_currency == true
66
- Spree::Deprecation.warn(
67
- 'Spree::Config.raise_with_invalid_currency set to true is ' \
68
- 'deprecated. Please note that by switching this value, ' \
69
- 'Spree::LineItem::CurrencyMismatch will not be raised anymore.',
70
- caller
71
- )
72
- end
73
- if Spree::Config.consider_actionless_promotion_active == true
74
- Spree::Deprecation.warn(
75
- 'Spree::Config.consider_actionless_promotion_active set to true is ' \
76
- 'deprecated. Please note that by switching this value, ' \
77
- 'promotions with no actions will be considered active.',
78
- caller
79
- )
80
- end
81
- if Spree::Config.run_order_validations_on_order_updater != true
82
- Spree::Deprecation.warn(
83
- 'Spree::Config.run_order_validations_on_order_updater set to false is ' \
84
- 'deprecated and will not be possibile in Solidus 3.0. Please switch this ' \
85
- 'value to true and check that everything works as expected.',
86
- caller
87
- )
88
- end
89
-
90
- if Spree::Config.use_legacy_address_state_validator != false
91
- Spree::Deprecation.warn(<<~DEPRECATION.squish, caller)
92
- Spree::Config.use_legacy_address_state_validator set to true has been
93
- deprecated and will be removed in Solidus 3.0. The Spree::Address state
94
- validation has been extracted into a configurable external class.
95
- Switch Spree::Config.use_legacy_address_state_validator to false to start
96
- using the external validation class.
97
- DEPRECATION
98
- end
99
-
100
59
  # Load in mailer previews for apps to use in development.
101
60
  # We need to make sure we call `Preview.all` before requiring our
102
61
  # previews, otherwise any previews the app attempts to add need to be
@@ -109,14 +68,6 @@ module Spree
109
68
  end
110
69
  end
111
70
  end
112
-
113
- config.after_initialize do
114
- if defined?(Spree::Auth::Engine) &&
115
- Gem::Version.new(Spree::Auth::VERSION) < Gem::Version.new('2.5.4') &&
116
- defined?(Spree::UsersController)
117
- Spree::UsersController.protect_from_forgery with: :exception
118
- end
119
- end
120
71
  end
121
72
  end
122
73
  end
@@ -22,15 +22,6 @@ module Spree
22
22
  end
23
23
  end
24
24
  end
25
-
26
- def add_class(name)
27
- Spree::Deprecation.warn(
28
- 'This method is deprecated. ' \
29
- "Please use `#{self.class}.add_class_set(#{name.inspect})` instead.",
30
- caller,
31
- )
32
- singleton_class.send(:add_class_set, name)
33
- end
34
25
  end
35
26
  end
36
27
  end
@@ -153,46 +153,6 @@ module Spree
153
153
  labels: brands.sort.map { |key| [key, key] }
154
154
  }
155
155
  end
156
-
157
- # Provide filtering on the immediate children of a taxon
158
- #
159
- # This doesn't fit the pattern of the examples above, so there's a few changes.
160
- # Firstly, it uses an existing scope which was not built for filtering - and so
161
- # has no need of a conditions mapping, and secondly, it has a mapping of name
162
- # to the argument type expected by the other scope.
163
- #
164
- # This technique is useful for filtering on objects (by passing ids) or with a
165
- # scope that can be used directly (eg. testing only ever on a single property).
166
- #
167
- # This scope selects products in any of the active taxons or their children.
168
- #
169
- def self.taxons_below(taxon)
170
- Spree::Deprecation.warn "taxons_below is deprecated in solidus_core. Please add it to your own application to continue using it."
171
- return Spree::Core::ProductFilters.all_taxons if taxon.nil?
172
- {
173
- name: 'Taxons under ' + taxon.name,
174
- scope: :taxons_id_in_tree_any,
175
- labels: taxon.children.sort_by(&:position).map { |element| [element.name, element.id] },
176
- conds: nil
177
- }
178
- end
179
-
180
- # Filtering by the list of all taxons
181
- #
182
- # Similar idea as above, but we don't want the descendants' products, hence
183
- # it uses one of the auto-generated scopes from Ransack.
184
- #
185
- # idea: expand the format to allow nesting of labels?
186
- def self.all_taxons
187
- Spree::Deprecation.warn "all_taxons is deprecated in solidus_core. Please add it to your own application to continue using it."
188
- taxons = Spree::Taxonomy.all.flat_map { |element| [element.root] + element.root.descendants }
189
- {
190
- name: 'All taxons',
191
- scope: :taxons_id_equals_any,
192
- labels: taxons.sort_by(&:name).map { |element| [element.name, element.id] },
193
- conds: nil # not needed
194
- }
195
- end
196
156
  end
197
157
  end
198
158
  end
@@ -31,20 +31,6 @@ module Spree
31
31
 
32
32
  attr_accessor :roles
33
33
 
34
- class << self
35
- def instance
36
- Spree::Deprecation.warn "Spree::RoleConfiguration.instance is DEPRECATED use Spree::Config.roles instead"
37
- Spree::Config.roles
38
- end
39
-
40
- # Yields the instance of the singleton, used for configuration
41
- # @yieldparam instance [Spree::RoleConfiguration]
42
- def configure
43
- Spree::Deprecation.warn "Spree::RoleConfiguration.configure is deprecated. Call Spree::Config.roles.assign_permissions instead"
44
- yield(Spree::Config.roles)
45
- end
46
- end
47
-
48
34
  # Given a CanCan::Ability, and a user, determine what permissions sets can
49
35
  # be activated on the ability, then activate them.
50
36
  #