Skip to content

Commit

Permalink
Conditionally call OrderUpdater#run_hooks
Browse files Browse the repository at this point in the history
As the method is deprecated, we should limit calling it to only when
strictly necessary, ie when there's some actual hook to be executed.
  • Loading branch information
spaghetticode committed Mar 20, 2020
1 parent d860b8e commit e079812
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/app/models/spree/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def finalize!

updater.update_shipment_state
save!
updater.run_hooks
update_hooks.any? && updater.run_hooks

touch :completed_at

Expand Down
2 changes: 1 addition & 1 deletion core/app/models/spree/order_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def update
update_shipments
update_shipment_state
end
run_hooks
update_hooks.any? && run_hooks
Spree::Event.fire 'order_recalculated', order: order
persist_totals
end
Expand Down

0 comments on commit e079812

Please sign in to comment.