solidus_core 2.11.0 → 2.11.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/spree/address.rb +28 -5
  3. data/app/models/spree/base.rb +1 -2
  4. data/app/models/spree/calculator.rb +4 -4
  5. data/app/models/spree/calculator/free_shipping.rb +1 -0
  6. data/app/models/spree/calculator/percent_per_item.rb +2 -0
  7. data/app/models/spree/calculator/price_sack.rb +1 -0
  8. data/app/models/spree/order/payments.rb +2 -2
  9. data/app/models/spree/order_merger.rb +1 -1
  10. data/app/models/spree/payment.rb +10 -3
  11. data/app/models/spree/payment/cancellation.rb +3 -22
  12. data/app/models/spree/payment_source.rb +2 -2
  13. data/app/models/spree/product.rb +8 -2
  14. data/app/models/spree/product/scopes.rb +0 -1
  15. data/app/models/spree/refund.rb +7 -1
  16. data/app/models/spree/shipping_method.rb +1 -1
  17. data/app/models/spree/stock/availability_validator.rb +2 -2
  18. data/app/models/spree/stock/inventory_validator.rb +2 -2
  19. data/app/models/spree/taxon/active_storage_attachment.rb +1 -2
  20. data/app/models/spree/taxon/paperclip_attachment.rb +1 -0
  21. data/db/migrate/20180416083007_add_apply_to_all_to_variant_property_rule.rb +1 -1
  22. data/db/migrate/20210122110141_add_name_to_spree_addresses.rb +13 -0
  23. data/lib/generators/spree/dummy/templates/rails/test.rb +4 -1
  24. data/lib/spree/app_configuration.rb +1 -1
  25. data/lib/spree/core.rb +1 -4
  26. data/lib/spree/core/engine.rb +7 -8
  27. data/lib/spree/core/version.rb +1 -1
  28. data/lib/spree/permitted_attributes.rb +5 -5
  29. data/lib/spree/testing_support.rb +31 -0
  30. data/lib/spree/testing_support/dummy_app.rb +4 -2
  31. data/lib/spree/testing_support/dummy_app/mailer_previews/test_mailer_preview.rb +4 -0
  32. data/lib/spree/testing_support/factories.rb +8 -4
  33. data/lib/spree/testing_support/factories/address_factory.rb +6 -2
  34. data/lib/spree/testing_support/factories/adjustment_factory.rb +10 -5
  35. data/lib/spree/testing_support/factories/adjustment_reason_factory.rb +5 -0
  36. data/lib/spree/testing_support/factories/calculator_factory.rb +5 -0
  37. data/lib/spree/testing_support/factories/carton_factory.rb +7 -2
  38. data/lib/spree/testing_support/factories/country_factory.rb +5 -0
  39. data/lib/spree/testing_support/factories/credit_card_factory.rb +5 -0
  40. data/lib/spree/testing_support/factories/customer_return_factory.rb +8 -3
  41. data/lib/spree/testing_support/factories/image_factory.rb +6 -1
  42. data/lib/spree/testing_support/factories/inventory_unit_factory.rb +9 -4
  43. data/lib/spree/testing_support/factories/line_item_factory.rb +7 -2
  44. data/lib/spree/testing_support/factories/option_type_factory.rb +8 -0
  45. data/lib/spree/testing_support/factories/option_value_factory.rb +5 -0
  46. data/lib/spree/testing_support/factories/order_factory.rb +11 -6
  47. data/lib/spree/testing_support/factories/order_promotion_factory.rb +7 -2
  48. data/lib/spree/testing_support/factories/payment_factory.rb +9 -4
  49. data/lib/spree/testing_support/factories/payment_method_factory.rb +5 -0
  50. data/lib/spree/testing_support/factories/price_factory.rb +6 -1
  51. data/lib/spree/testing_support/factories/product_factory.rb +10 -5
  52. data/lib/spree/testing_support/factories/product_option_type_factory.rb +7 -2
  53. data/lib/spree/testing_support/factories/product_property_factory.rb +7 -2
  54. data/lib/spree/testing_support/factories/promotion_category_factory.rb +5 -0
  55. data/lib/spree/testing_support/factories/promotion_code_factory.rb +7 -2
  56. data/lib/spree/testing_support/factories/promotion_factory.rb +7 -2
  57. data/lib/spree/testing_support/factories/property_factory.rb +5 -0
  58. data/lib/spree/testing_support/factories/refund_factory.rb +7 -2
  59. data/lib/spree/testing_support/factories/refund_reason_factory.rb +5 -0
  60. data/lib/spree/testing_support/factories/reimbursement_factory.rb +6 -1
  61. data/lib/spree/testing_support/factories/reimbursement_type_factory.rb +5 -0
  62. data/lib/spree/testing_support/factories/return_authorization_factory.rb +8 -3
  63. data/lib/spree/testing_support/factories/return_item_factory.rb +8 -3
  64. data/lib/spree/testing_support/factories/return_reason_factory.rb +5 -0
  65. data/lib/spree/testing_support/factories/role_factory.rb +5 -0
  66. data/lib/spree/testing_support/factories/shipment_factory.rb +9 -3
  67. data/lib/spree/testing_support/factories/shipping_category_factory.rb +5 -0
  68. data/lib/spree/testing_support/factories/shipping_method_factory.rb +8 -3
  69. data/lib/spree/testing_support/factories/shipping_rate_factory.rb +7 -2
  70. data/lib/spree/testing_support/factories/state_factory.rb +7 -1
  71. data/lib/spree/testing_support/factories/stock_item_factory.rb +7 -2
  72. data/lib/spree/testing_support/factories/stock_location_factory.rb +8 -3
  73. data/lib/spree/testing_support/factories/stock_movement_factory.rb +6 -1
  74. data/lib/spree/testing_support/factories/stock_package_factory.rb +7 -2
  75. data/lib/spree/testing_support/factories/store_credit_category_factory.rb +5 -0
  76. data/lib/spree/testing_support/factories/store_credit_event_factory.rb +7 -2
  77. data/lib/spree/testing_support/factories/store_credit_factory.rb +8 -3
  78. data/lib/spree/testing_support/factories/store_credit_reason_factory.rb +5 -0
  79. data/lib/spree/testing_support/factories/store_credit_type_factory.rb +5 -0
  80. data/lib/spree/testing_support/factories/store_factory.rb +6 -1
  81. data/lib/spree/testing_support/factories/tax_category_factory.rb +7 -1
  82. data/lib/spree/testing_support/factories/tax_rate_factory.rb +8 -3
  83. data/lib/spree/testing_support/factories/taxon_factory.rb +7 -2
  84. data/lib/spree/testing_support/factories/taxonomy_factory.rb +5 -0
  85. data/lib/spree/testing_support/factories/user_factory.rb +8 -3
  86. data/lib/spree/testing_support/factories/variant_factory.rb +9 -4
  87. data/lib/spree/testing_support/factories/variant_property_rule_condition_factory.rb +7 -2
  88. data/lib/spree/testing_support/factories/variant_property_rule_factory.rb +8 -3
  89. data/lib/spree/testing_support/factories/variant_property_rule_value_factory.rb +7 -2
  90. data/lib/spree/testing_support/factories/zone_factory.rb +7 -2
  91. data/lib/spree/testing_support/factory_bot.rb +68 -0
  92. data/lib/spree/testing_support/fixtures/blank.jpg +0 -0
  93. data/lib/spree/testing_support/order_walkthrough.rb +10 -10
  94. data/lib/spree/testing_support/sequences.rb +4 -1
  95. data/{app/models → lib}/spree/user_class_handle.rb +0 -0
  96. data/lib/tasks/email.rake +3 -2
  97. data/lib/tasks/migrations/migrate_address_names.rake +158 -0
  98. data/lib/tasks/migrations/migrate_default_billing_addresses_to_address_book.rake +38 -0
  99. data/lib/tasks/upgrade.rake +13 -0
  100. data/solidus_core.gemspec +24 -2
  101. metadata +50 -24
  102. data/lib/spree/awesome_nested_set_override.rb +0 -44
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67f52a65e6e81c1ce08998d4e78697917ec11a458b2186407c8787e5f720f438
4
- data.tar.gz: 744a81976801433d6db59d9b91838b5f726a5760248d5d35bf5479d10b6548c8
3
+ metadata.gz: 5e525e5e27176da6331f5bce6a0075f2c06f2da77f9d8aad9d78a861a121219c
4
+ data.tar.gz: f828d4522d8c58822fc71daa609b7411102dbdcf55e7abb4f582102c23ddbfbd
5
5
  SHA512:
6
- metadata.gz: 656ba324a01abefe949d50477b37f1414176ebc8ae025e6875d61d505fd71255243ef3814cf5c3283a32910c4275c434883e445257be8d3e0c98c42b256858d0
7
- data.tar.gz: 4efde61091581ff5c04c56363b070278be880cf797ac5d0c494667842486c6896b20c5feb5342e565e891e7dd2b8f3c52c350956258210d6b074cb8664452099
6
+ metadata.gz: ca14ba69f5a7347fd1bc88d8d209e4ffbe2d4a9419fd257f036391d55581250569ac66683a6b5c27a1342f4b5f8120b0483ba16538f8107ded796bda44551c6d
7
+ data.tar.gz: f36de4fb9dc7addc88b586277f111b854dbbcfba3d586d52a62c2c4aaddc19e6bf536b74151a461df11566d3609df6fbc60889e70b9bbded67dc6ae740ae64dc
@@ -92,6 +92,12 @@ module Spree
92
92
  if base['lastname'].presence || base['last_name'].presence
93
93
  base['lastname'] = name_from_attributes.last_name
94
94
  end
95
+
96
+ virtual_name = name_from_attributes.value
97
+ if base['name'].blank? && virtual_name.present?
98
+ base['name'] = virtual_name
99
+ end
100
+
95
101
  excluded_attributes = DB_ONLY_ATTRS + %w(first_name last_name)
96
102
 
97
103
  base.except(*excluded_attributes)
@@ -120,7 +126,11 @@ module Spree
120
126
  # @return [Boolean] true if the two addresses have the same address fields
121
127
  def ==(other_address)
122
128
  return false unless other_address && other_address.respond_to?(:value_attributes)
123
- value_attributes == other_address.value_attributes
129
+ if Spree::Config.use_combined_first_and_last_name_in_address
130
+ value_attributes.except(*LEGACY_NAME_ATTRS) == other_address.value_attributes.except(*LEGACY_NAME_ATTRS)
131
+ else
132
+ value_attributes == other_address.value_attributes
133
+ end
124
134
  end
125
135
 
126
136
  # @deprecated Do not use this. Use Address.== instead.
@@ -193,17 +203,30 @@ module Spree
193
203
  country && country.iso
194
204
  end
195
205
 
206
+ before_save :set_name_from_firstname_and_lastname
207
+
208
+ def set_name_from_firstname_and_lastname
209
+ name_from_firstname_and_lastname = Spree::Address::Name.from_attributes(attributes.except(:name, 'name'))
210
+
211
+ if read_attribute(:name).blank? && name_from_firstname_and_lastname.present?
212
+ write_attribute(:name, name_from_firstname_and_lastname)
213
+ end
214
+ end
215
+
196
216
  # @return [String] the full name on this address
197
217
  def name
198
- Spree::Address::Name.new(
199
- read_attribute(:firstname),
200
- read_attribute(:lastname)
201
- ).value
218
+ self[:name] || begin
219
+ Spree::Address::Name.new(
220
+ read_attribute(:firstname),
221
+ read_attribute(:lastname)
222
+ ).value
223
+ end
202
224
  end
203
225
 
204
226
  def name=(value)
205
227
  return if value.nil?
206
228
 
229
+ write_attribute(:name, value)
207
230
  name_from_value = Spree::Address::Name.new(value)
208
231
  write_attribute(:firstname, name_from_value.first_name)
209
232
  write_attribute(:lastname, name_from_value.last_name)
@@ -3,8 +3,6 @@
3
3
  class Spree::Base < ActiveRecord::Base
4
4
  include Spree::Preferences::Preferable
5
5
  include Spree::Core::Permalinks
6
- serialize :preferences, Hash
7
-
8
6
  include Spree::RansackableAttributes
9
7
 
10
8
  def initialize_preference_defaults
@@ -18,6 +16,7 @@ class Spree::Base < ActiveRecord::Base
18
16
  def self.preference(*args)
19
17
  # after_initialize can be called multiple times with the same symbol, it
20
18
  # will only be called once on initialization.
19
+ serialize :preferences, Hash
21
20
  after_initialize :initialize_preference_defaults
22
21
  super
23
22
  end
@@ -10,12 +10,12 @@ module Spree
10
10
  def compute(computable)
11
11
  # Spree::LineItem -> :compute_line_item
12
12
  computable_name = computable.class.name.demodulize.underscore
13
- method = "compute_#{computable_name}".to_sym
13
+ method_name = "compute_#{computable_name}".to_sym
14
14
  calculator_class = self.class
15
- if respond_to?(method)
16
- send(method, computable)
15
+ if respond_to?(method_name)
16
+ send(method_name, computable)
17
17
  else
18
- raise NotImplementedError, "Please implement '#{method}(#{computable_name})' in your calculator: #{calculator_class.name}"
18
+ raise NotImplementedError, "Please implement '#{method_name}(#{computable_name})' in your calculator: #{calculator_class.name}"
19
19
  end
20
20
  end
21
21
 
@@ -8,6 +8,7 @@ module Spree
8
8
  # now a Promotion Action which deals with these types of promotions instead.
9
9
  class Calculator::FreeShipping < Calculator
10
10
  def compute(object)
11
+ Spree::Deprecation.warn('This method is deprecated, because it is no longer used')
11
12
  if object.is_a?(Array)
12
13
  return if object.empty?
13
14
  order = object.first.order
@@ -15,6 +15,8 @@ module Spree
15
15
  preference :percent, :decimal, default: 0
16
16
 
17
17
  def compute(object = nil)
18
+ Spree::Deprecation.warn('This method is deprecated, please use adjustments at line item level')
19
+
18
20
  return 0 if object.nil?
19
21
  object.line_items.sum { |line_item|
20
22
  value_for_line_item(line_item)
@@ -11,6 +11,7 @@ module Spree
11
11
 
12
12
  # as object we always get line items, as calculable we have Coupon, ShippingMethod
13
13
  def compute(object)
14
+ Spree::Deprecation.warn('This method is deprecated, please use adjustments at line item level')
14
15
  if object.is_a?(Array)
15
16
  base = object.sum { |element| element.respond_to?(:amount) ? element.amount : BigDecimal(element.to_s) }
16
17
  else
@@ -37,14 +37,14 @@ module Spree
37
37
 
38
38
  private
39
39
 
40
- def process_payments_with(method)
40
+ def process_payments_with(method_name)
41
41
  # Don't run if there is nothing to pay.
42
42
  return true if payment_total >= total
43
43
 
44
44
  unprocessed_payments.each do |payment|
45
45
  break if payment_total >= total
46
46
 
47
- payment.public_send(method)
47
+ payment.public_send(method_name)
48
48
  end
49
49
  rescue Core::GatewayError => error
50
50
  result = !!Spree::Config[:allow_checkout_on_gateway_error]
@@ -128,7 +128,7 @@ module Spree
128
128
  # @param [Spree::LineItem] line_item The line item which could not be saved
129
129
  # @return [void]
130
130
  def handle_error(line_item)
131
- order.errors[:base] << line_item.errors.full_messages
131
+ order.errors.add(:base, line_item.errors.full_messages)
132
132
  end
133
133
 
134
134
  # Save the order totals after merge
@@ -168,9 +168,16 @@ module Spree
168
168
 
169
169
  def validate_source
170
170
  if source && !source.valid?
171
- source.errors.each do |field, error|
172
- field_name = I18n.t("activerecord.attributes.#{source.class.to_s.underscore}.#{field}")
173
- errors.add(I18n.t(source.class.to_s.demodulize.underscore, scope: 'spree'), "#{field_name} #{error}")
171
+ if Gem::Requirement.new(">= 6.1").satisfied_by?(Rails.gem_version)
172
+ source.errors.each do |error|
173
+ field_name = I18n.t("activerecord.attributes.#{source.class.to_s.underscore}.#{error.attribute}")
174
+ errors.add(I18n.t(source.class.to_s.demodulize.underscore, scope: 'spree'), "#{field_name} #{error.message}")
175
+ end
176
+ else
177
+ source.errors.each do |field, error|
178
+ field_name = I18n.t("activerecord.attributes.#{source.class.to_s.underscore}.#{field}")
179
+ errors.add(I18n.t(source.class.to_s.demodulize.underscore, scope: 'spree'), "#{field_name} #{error}")
180
+ end
174
181
  end
175
182
  end
176
183
  if errors.any?
@@ -26,16 +26,10 @@ module Spree
26
26
  # @param payment [Spree::Payment] - the payment that should be canceled
27
27
  #
28
28
  def cancel(payment)
29
- # For payment methods already implemeting `try_void`
30
- if try_void_available?(payment.payment_method)
31
- if response = payment.payment_method.try_void(payment)
32
- payment.handle_void_response(response)
33
- else
34
- payment.refunds.create!(amount: payment.credit_allowed, reason: refund_reason, perform_after_create: false).perform!
35
- end
29
+ if response = payment.payment_method.try_void(payment)
30
+ payment.handle_void_response(response)
36
31
  else
37
- # For payment methods not yet implemeting `try_void`
38
- deprecated_behavior(payment)
32
+ payment.refunds.create!(amount: payment.credit_allowed, reason: refund_reason, perform_after_create: false).perform!
39
33
  end
40
34
  end
41
35
 
@@ -44,19 +38,6 @@ module Spree
44
38
  def refund_reason
45
39
  Spree::RefundReason.where(name: reason).first_or_create
46
40
  end
47
-
48
- def try_void_available?(payment_method)
49
- payment_method.respond_to?(:try_void) &&
50
- payment_method.method(:try_void).owner != Spree::PaymentMethod
51
- end
52
-
53
- def deprecated_behavior(payment)
54
- Spree::Deprecation.warn "#{payment.payment_method.class.name}#cancel is deprecated and will be removed. " \
55
- 'Please implement a `try_void` method instead that returns a response object if void succeeds ' \
56
- 'or `false|nil` if not. Solidus will refund the payment then.'
57
- response = payment.payment_method.cancel(payment.response_code)
58
- payment.handle_void_response(response)
59
- end
60
41
  end
61
42
  end
62
43
  end
@@ -23,9 +23,9 @@ module Spree
23
23
  end
24
24
 
25
25
  # @param payment [Spree::Payment] the payment we want to know if can be voided
26
- # @return [Boolean] true when the payment is not failed or voided
26
+ # @return [Boolean] true when the payment is not failed, voided or invalid
27
27
  def can_void?(payment)
28
- !payment.failed? && !payment.void?
28
+ payment.can_void?
29
29
  end
30
30
 
31
31
  # Indicates whether its possible to credit the payment. Note that most
@@ -366,8 +366,14 @@ module Spree
366
366
  # If the master is invalid, the Product object will be assigned its errors
367
367
  def validate_master
368
368
  unless master.valid?
369
- master.errors.each do |att, error|
370
- errors.add(att, error)
369
+ if Gem::Requirement.new(">= 6.1").satisfied_by?(Rails.gem_version)
370
+ master.errors.each do |error|
371
+ errors.add(error.attribute, error.message)
372
+ end
373
+ else
374
+ master.errors.each do |att, error|
375
+ errors.add(att, error)
376
+ end
371
377
  end
372
378
  end
373
379
  end
@@ -70,7 +70,6 @@ module Spree
70
70
  add_search_scope :in_taxon do |taxon|
71
71
  includes(:classifications)
72
72
  .where('spree_products_taxons.taxon_id' => taxon.self_and_descendants.pluck(:id))
73
- .select(Spree::Classification.arel_table[:position])
74
73
  .order(Spree::Classification.arel_table[:position].asc)
75
74
  end
76
75
 
@@ -61,7 +61,13 @@ module Spree
61
61
  )
62
62
 
63
63
  log_entries.build(details: perform_response.to_yaml)
64
- update!(transaction_id: perform_response.authorization)
64
+
65
+ self.transaction_id = perform_response.authorization
66
+ # This is needed otherwise set_perform_after_create_default callback
67
+ # will print a deprecation warning when save! creates a record.
68
+ self.perform_after_create = false unless persisted?
69
+ save!
70
+
65
71
  update_order
66
72
  end
67
73
 
@@ -119,7 +119,7 @@ module Spree
119
119
 
120
120
  def at_least_one_shipping_category
121
121
  if shipping_categories.empty?
122
- errors[:base] << "You need to select at least one shipping category"
122
+ errors.add(:base, "You need to select at least one shipping category")
123
123
  end
124
124
  end
125
125
  end
@@ -11,10 +11,10 @@ module Spree
11
11
  display_name = variant.name.to_s
12
12
  display_name += %{ (#{variant.options_text})} unless variant.options_text.blank?
13
13
 
14
- line_item.errors[:quantity] << I18n.t(
14
+ line_item.errors.add(:quantity, I18n.t(
15
15
  'spree.selected_quantity_not_available',
16
16
  item: display_name.inspect
17
- )
17
+ ))
18
18
  false
19
19
  end
20
20
  end
@@ -5,10 +5,10 @@ module Spree
5
5
  class InventoryValidator < ActiveModel::Validator
6
6
  def validate(line_item)
7
7
  if line_item.inventory_units.count != line_item.quantity
8
- line_item.errors[:inventory] << I18n.t(
8
+ line_item.errors.add(:inventory, I18n.t(
9
9
  'spree.inventory_not_available',
10
10
  item: line_item.variant.name
11
- )
11
+ ))
12
12
  end
13
13
  end
14
14
  end
@@ -9,11 +9,10 @@ module Spree::Taxon::ActiveStorageAttachment
9
9
  styles: { mini: '32x32>', normal: '128x128>' },
10
10
  default_style: :mini
11
11
  validate :icon_is_an_image
12
-
13
-
14
12
  end
15
13
 
16
14
  def attachment_partial_name
15
+ Spree::Deprecation.warn("calling #attachment_partial_name on Spree::Taxon is deprecated without replacement.")
17
16
  'paperclip'
18
17
  end
19
18
  end
@@ -20,6 +20,7 @@ module Spree::Taxon::PaperclipAttachment
20
20
  end
21
21
 
22
22
  def attachment_partial_name
23
+ Spree::Deprecation.warn("calling #attachment_partial_name on Spree::Taxon is deprecated without replacement.")
23
24
  'paperclip'
24
25
  end
25
26
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class AddApplyToAllToVariantPropertyRule < ActiveRecord::Migration[5.1]
4
- def change
4
+ def up
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
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddNameToSpreeAddresses < ActiveRecord::Migration[5.2]
4
+ def up
5
+ add_column :spree_addresses, :name, :string
6
+ add_index :spree_addresses, :name
7
+ end
8
+
9
+ def down
10
+ remove_index :spree_addresses, :name
11
+ remove_column :spree_addresses, :name
12
+ end
13
+ end
@@ -20,11 +20,14 @@ Dummy::Application.configure do
20
20
  # Raise exceptions instead of rendering exception templates
21
21
  config.action_dispatch.show_exceptions = false
22
22
 
23
+ # Disable request forgery protection in test environment
24
+ config.action_controller.allow_forgery_protection = false
25
+
23
26
  # Tell Action Mailer not to deliver emails to the real world.
24
27
  # The :test delivery method accumulates sent emails in the
25
28
  # ActionMailer::Base.deliveries array.
26
29
  config.action_mailer.delivery_method = :test
27
- ActionMailer::Base.default from: "spree@example.com"
30
+ ActionMailer::Base.default from: "solidus@example.com"
28
31
 
29
32
  # Raise on deprecation warnings
30
33
  if ENV['SOLIDUS_RAISE_DEPRECATIONS'].present?
@@ -190,7 +190,7 @@ module Spree
190
190
 
191
191
  # @!attribute [rw] mails_from
192
192
  # @return [String] Email address used as +From:+ field in transactional emails.
193
- preference :mails_from, :string, default: 'spree@example.com'
193
+ preference :mails_from, :string, default: 'solidus@example.com'
194
194
 
195
195
  # @!attribute [rw] max_level_in_taxons_menu
196
196
  # @return [Integer] maximum nesting level in taxons menu (default: +1+)
data/lib/spree/core.rb CHANGED
@@ -90,11 +90,8 @@ require 'spree/core/state_machines'
90
90
  require 'spree/core/stock_configuration'
91
91
  require 'spree/core/validators/email'
92
92
  require 'spree/permission_sets'
93
+ require 'spree/user_class_handle'
93
94
 
94
95
  require 'spree/preferences/store'
95
96
  require 'spree/preferences/static_model_preferences'
96
97
  require 'spree/preferences/scoped_store'
97
-
98
- if Rails.gem_version >= Gem::Version.new('6.1.0.alpha')
99
- require 'spree/awesome_nested_set_override'
100
- end
@@ -86,19 +86,18 @@ module Spree
86
86
  Spree::Config.use_legacy_address_state_validator set to true has been
87
87
  deprecated and will be removed in Solidus 3.0. The Spree::Address state
88
88
  validation has been extracted into a configurable external class.
89
- Switch Spree::Config.use_legacy_address_state_validator to true to start
89
+ Switch Spree::Config.use_legacy_address_state_validator to false to start
90
90
  using the external validation class.
91
91
  DEPRECATION
92
92
  end
93
- end
94
93
 
95
- # Load in mailer previews for apps to use in development.
96
- # We need to make sure we call `Preview.all` before requiring our
97
- # previews, otherwise any previews the app attempts to add need to be
98
- # manually required.
99
- if Rails.env.development?
100
- initializer "spree.mailer_previews" do
94
+ # Load in mailer previews for apps to use in development.
95
+ # We need to make sure we call `Preview.all` before requiring our
96
+ # previews, otherwise any previews the app attempts to add need to be
97
+ # manually required.
98
+ if Rails.env.development? || Rails.env.test?
101
99
  ActionMailer::Preview.all
100
+
102
101
  Dir[root.join("lib/spree/mailer_previews/**/*_preview.rb")].each do |file|
103
102
  require_dependency file
104
103
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spree
4
- VERSION = "2.11.0"
4
+ VERSION = "2.11.5"
5
5
 
6
6
  def self.solidus_version
7
7
  VERSION