solidus_core 3.0.1 → 3.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23a2ea44528d022e92a2e20276022fc71a8870a7b51502dcfcd441e31789606a
4
- data.tar.gz: ca5d3d936f3e8517aecf63b458e40800fb16f4c0d6f434e90e8e3f8c0d21a030
3
+ metadata.gz: 275634b986861f1d46f20d5c8dea9408edb6ec94b1ef7166f4628192284ada9f
4
+ data.tar.gz: 3bf674ac805c53475aba8f1a531df66d4c169bac1714f413384041c54991247b
5
5
  SHA512:
6
- metadata.gz: f61253c30c143c442ff677c483119cf9831aceadde9179dd7aec8247d32d0bbb776b300387966eeaac36df7fb00ea439ebab025321426f8d465469b6d5dec1c3
7
- data.tar.gz: 0b2e62a6323d33962f9019399a62a47944d9f2698ca3b7c6d725a70d66a5fdab47def7960428a9d4586d65b1a7421f26eefe3948c122fc7c1ce47a8f57e8ab07
6
+ metadata.gz: c90f454bdf14219807e9cef5470c777733af9a225357a31999913f984af23da81ba80b044966b59113499984287c84b55834a9475c34b3f0054c0a2599bac325
7
+ data.tar.gz: 1b7c8ac8e0cbe4bfb77aa4e51cf4c863387fff1e360424a7ec02006675c6f7bf976a728b39ed8e7ee6fccd0aa56878ac599bb64be660af32a4726f693a3da302
@@ -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
- self.shipments = Spree::Config.stock.coordinator_class.new(self).shipments
493
+ shipments.push(*Spree::Config.stock.coordinator_class.new(self).shipments)
494
494
  end
495
495
  end
496
496
 
@@ -45,7 +45,6 @@ module Spree
45
45
 
46
46
  has_many :variants,
47
47
  -> { where(is_master: false).order(:position) },
48
- inverse_of: :product,
49
48
  class_name: 'Spree::Variant'
50
49
 
51
50
  has_many :variants_including_master,
@@ -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)
@@ -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: :variants, optional: false
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?,
@@ -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 = /\A([^@\.]|[^@\.]([^@\s]*)[^@\.])@([^@\s]+\.)+[^@\s]+\z/
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
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spree
4
- VERSION = "3.0.1"
4
+ VERSION = "3.0.5"
5
5
 
6
6
  def self.solidus_version
7
7
  VERSION
@@ -51,7 +51,13 @@ module Spree
51
51
  :month, :year, :expiry, :first_name, :last_name, :name
52
52
  ]
53
53
 
54
- @@customer_return_attributes = [:stock_location_id, return_items_attributes: [:id, :inventory_unit_id, :return_authorization_id, :returned, :amount, :reception_status_event, :acceptance_status, :exchange_variant_id, :resellable]]
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
 
@@ -5,7 +5,7 @@ module Spree
5
5
  module BlacklistUrls
6
6
  def setup_url_blacklist(browser)
7
7
  if browser.respond_to?(:url_blacklist)
8
- browser.url_blacklist = ['http://fonts.googleapis.com']
8
+ browser.url_blacklist = ['https://fonts.googleapis.com']
9
9
  end
10
10
  end
11
11
  end
@@ -46,6 +46,7 @@ module DummyApp
46
46
  end
47
47
 
48
48
  class Application < ::Rails::Application
49
+ config.has_many_inverse = true
49
50
  config.eager_load = false
50
51
  config.cache_classes = true
51
52
  config.cache_store = :memory_store
@@ -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.1
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-05-10 00:00:00.000000000 Z
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.4
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: []