solidus_core 3.0.1 → 3.0.5
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/models/spree/order.rb +1 -1
- data/app/models/spree/product.rb +0 -1
- data/app/models/spree/return_item.rb +2 -3
- data/app/models/spree/stock/simple_coordinator.rb +6 -1
- data/app/models/spree/variant.rb +1 -1
- data/lib/spree/core/engine.rb +8 -0
- data/lib/spree/core/validators/email.rb +2 -2
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/permitted_attributes.rb +7 -1
- data/lib/spree/testing_support/blacklist_urls.rb +1 -1
- data/lib/spree/testing_support/dummy_app.rb +1 -0
- data/lib/tasks/solidus/check_orders_with_invalid_email.rake +18 -0
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 275634b986861f1d46f20d5c8dea9408edb6ec94b1ef7166f4628192284ada9f
|
4
|
+
data.tar.gz: 3bf674ac805c53475aba8f1a531df66d4c169bac1714f413384041c54991247b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c90f454bdf14219807e9cef5470c777733af9a225357a31999913f984af23da81ba80b044966b59113499984287c84b55834a9475c34b3f0054c0a2599bac325
|
7
|
+
data.tar.gz: 1b7c8ac8e0cbe4bfb77aa4e51cf4c863387fff1e360424a7ec02006675c6f7bf976a728b39ed8e7ee6fccd0aa56878ac599bb64be660af32a4726f693a3da302
|
data/app/models/spree/order.rb
CHANGED
@@ -490,7 +490,7 @@ module Spree
|
|
490
490
|
raise CannotRebuildShipments.new(I18n.t('spree.cannot_rebuild_shipments_shipments_not_pending'))
|
491
491
|
else
|
492
492
|
shipments.destroy_all
|
493
|
-
|
493
|
+
shipments.push(*Spree::Config.stock.coordinator_class.new(self).shipments)
|
494
494
|
end
|
495
495
|
end
|
496
496
|
|
data/app/models/spree/product.rb
CHANGED
@@ -254,10 +254,9 @@ module Spree
|
|
254
254
|
}).where.not(id: id).first
|
255
255
|
|
256
256
|
if other_return_item && (new_record? || COMPLETED_RECEPTION_STATUSES.include?(reception_status.to_sym))
|
257
|
-
errors.add(:inventory_unit, :other_completed_return_item_exists,
|
257
|
+
errors.add(:inventory_unit, :other_completed_return_item_exists,
|
258
258
|
inventory_unit_id: inventory_unit_id,
|
259
|
-
return_item_id: other_return_item.id
|
260
|
-
})
|
259
|
+
return_item_id: other_return_item.id)
|
261
260
|
end
|
262
261
|
end
|
263
262
|
|
@@ -73,11 +73,16 @@ module Spree
|
|
73
73
|
packages = split_packages(packages)
|
74
74
|
|
75
75
|
# Turn the Stock::Packages into a Shipment with rates
|
76
|
-
packages.map do |package|
|
76
|
+
shipments = packages.map do |package|
|
77
77
|
shipment = package.shipment = package.to_shipment
|
78
78
|
shipment.shipping_rates = Spree::Config.stock.estimator_class.new.shipping_rates(package)
|
79
79
|
shipment
|
80
80
|
end
|
81
|
+
|
82
|
+
# Make sure we don't add the proposed shipments to the order
|
83
|
+
order.shipments = order.shipments - shipments
|
84
|
+
|
85
|
+
shipments
|
81
86
|
end
|
82
87
|
|
83
88
|
def split_packages(initial_packages)
|
data/app/models/spree/variant.rb
CHANGED
@@ -30,7 +30,7 @@ module Spree
|
|
30
30
|
attr_writer :rebuild_vat_prices
|
31
31
|
include Spree::DefaultPrice
|
32
32
|
|
33
|
-
belongs_to :product, -> { with_discarded }, touch: true, class_name: 'Spree::Product', inverse_of: :
|
33
|
+
belongs_to :product, -> { with_discarded }, touch: true, class_name: 'Spree::Product', inverse_of: :variants_including_master, optional: false
|
34
34
|
belongs_to :tax_category, class_name: 'Spree::TaxCategory', optional: true
|
35
35
|
|
36
36
|
delegate :name, :description, :slug, :available_on, :discontinue_on, :discontinued?,
|
data/lib/spree/core/engine.rb
CHANGED
@@ -68,6 +68,14 @@ module Spree
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
71
|
+
|
72
|
+
config.after_initialize do
|
73
|
+
if defined?(Spree::Auth::Engine) &&
|
74
|
+
Gem::Version.new(Spree::Auth::VERSION) < Gem::Version.new('2.5.4') &&
|
75
|
+
defined?(Spree::UsersController)
|
76
|
+
Spree::UsersController.protect_from_forgery with: :exception
|
77
|
+
end
|
78
|
+
end
|
71
79
|
end
|
72
80
|
end
|
73
81
|
end
|
@@ -12,11 +12,11 @@ module Spree
|
|
12
12
|
# end
|
13
13
|
#
|
14
14
|
class EmailValidator < ActiveModel::EachValidator
|
15
|
-
EMAIL_REGEXP =
|
15
|
+
EMAIL_REGEXP = URI::MailTo::EMAIL_REGEXP
|
16
16
|
|
17
17
|
def validate_each(record, attribute, value)
|
18
18
|
unless EMAIL_REGEXP.match? value
|
19
|
-
record.errors.add(attribute, :invalid, { value: value }.merge!(options))
|
19
|
+
record.errors.add(attribute, :invalid, **{ value: value }.merge!(options))
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
data/lib/spree/core/version.rb
CHANGED
@@ -51,7 +51,13 @@ module Spree
|
|
51
51
|
:month, :year, :expiry, :first_name, :last_name, :name
|
52
52
|
]
|
53
53
|
|
54
|
-
@@customer_return_attributes = [
|
54
|
+
@@customer_return_attributes = [
|
55
|
+
:stock_location_id, return_items_attributes: [
|
56
|
+
:id, :inventory_unit_id, :return_authorization_id, :returned, :amount,
|
57
|
+
:reception_status_event, :acceptance_status, :exchange_variant_id,
|
58
|
+
:resellable, :return_reason_id
|
59
|
+
]
|
60
|
+
]
|
55
61
|
|
56
62
|
@@image_attributes = [:alt, :attachment, :position, :viewable_type, :viewable_id]
|
57
63
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :solidus do
|
4
|
+
desc 'Prints orders with invalid email (after fix for GHSA-qxmr-qxh6-2cc9)'
|
5
|
+
task check_orders_with_invalid_email: :environment do
|
6
|
+
matches = Spree::Order.find_each.reduce([]) do |matches, order|
|
7
|
+
order.email.nil? || Spree::EmailValidator::EMAIL_REGEXP.match?(order.email) ? matches : matches + [order]
|
8
|
+
end
|
9
|
+
if matches.any?
|
10
|
+
puts 'Email / ID / Number'
|
11
|
+
puts(matches.map do |order|
|
12
|
+
"#{order.email} / #{order.id} / #{order.number}"
|
13
|
+
end.join("\n"))
|
14
|
+
else
|
15
|
+
puts 'NO MATCHES'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Solidus Team
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|
@@ -903,6 +903,7 @@ files:
|
|
903
903
|
- lib/spree/testing_support/url_helpers.rb
|
904
904
|
- lib/spree/user_class_handle.rb
|
905
905
|
- lib/spree_core.rb
|
906
|
+
- lib/tasks/solidus/check_orders_with_invalid_email.rake
|
906
907
|
- lib/tasks/upgrade.rake
|
907
908
|
- solidus_core.gemspec
|
908
909
|
- vendor/assets/javascripts/jquery.payment.js
|
@@ -944,8 +945,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
944
945
|
- !ruby/object:Gem::Version
|
945
946
|
version: 1.8.23
|
946
947
|
requirements: []
|
947
|
-
rubygems_version: 3.1.
|
948
|
-
signing_key:
|
948
|
+
rubygems_version: 3.1.2
|
949
|
+
signing_key:
|
949
950
|
specification_version: 4
|
950
951
|
summary: Essential models, mailers, and classes for the Solidus e-commerce project.
|
951
952
|
test_files: []
|