Skip to content

Commit

Permalink
Print a deprecation warning if order is updated without validations
Browse files Browse the repository at this point in the history
Also, this commit adds the new default value to the spree.rb
initializer, that will be used when installing new Solidus applications
and to the dummy app that will run specs with the new value set to the
new behavior's value.
  • Loading branch information
kennyadsl committed May 29, 2020
1 parent 17ac70c commit 12234d1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ Spree.config do |config|
# See https://github.com/solidusio/solidus/pull/3456 for more info.
config.raise_with_invalid_currency = false

# Set this configuration to `false` to avoid running validations when
# updating an order. Be careful since you can end up having inconsistent
# data in your database turning it on.
# See https://github.com/solidusio/solidus/pull/3645 for more info.
config.run_order_validations_on_order_updater = true

# Permission Sets:

# Uncomment and customize the following line to add custom permission sets
Expand Down
9 changes: 9 additions & 0 deletions core/lib/spree/core/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ class Engine < ::Rails::Engine
caller
)
end

if Spree::Config.run_order_validations_on_order_updater == false
Spree::Deprecation.warn(
'Spree::Config.run_order_validations_on_order_updater set to false is ' \
'deprecated and will not be possibile in Solidus 3.0. Please switch this ' \
'value to true and check that everything works as expected.',
caller
)
end
end

# Load in mailer previews for apps to use in development.
Expand Down
1 change: 1 addition & 0 deletions core/lib/spree/testing_support/dummy_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class Application < ::Rails::Application
Spree.config do |config|
config.mails_from = "[email protected]"
config.raise_with_invalid_currency = false
config.run_order_validations_on_order_updater = true
config.use_combined_first_and_last_name_in_address = true

if ENV['ENABLE_ACTIVE_STORAGE']
Expand Down

0 comments on commit 12234d1

Please sign in to comment.