Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/app/models/spree/in_memory_order_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ def recalculate(persist: true)
end
end

Spree::Bus.publish(:order_recalculated, order:)

persist_totals if persist
end

Spree::Bus.publish(:order_recalculated, order:) if persist
end
alias_method :update, :recalculate
deprecate update: :recalculate, deprecator: Spree.deprecator
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 @@ -27,9 +27,9 @@ def recalculate
update_shipments
recalculate_shipment_state
end
Spree::Bus.publish(:order_recalculated, order:)
persist_totals
end
Spree::Bus.publish(:order_recalculated, order:)
end
alias_method :update, :recalculate
deprecate update: :recalculate, deprecator: Spree.deprecator
Expand Down
6 changes: 6 additions & 0 deletions core/spec/models/spree/in_memory_order_updater_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,12 @@ module Spree

expect(item).to have_received(:do_something)
end

it "does not fire the event when persist: false" do
updater.recalculate(persist: false)

expect(item).not_to have_received(:do_something)
end
end

context "with invalid associated objects" do
Expand Down
Loading