-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove hardcoded created_by user from returns methods
This applies only to some deprecated blocks and does not change the new, working logic. This means that if those methods were used by some store or extension, they will now don't have the creator set instead of having a specific user that could even be not present in the database, causing the creator to be nil anyway.
- Loading branch information
Showing
5 changed files
with
0 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,7 +98,6 @@ def cancel_unit(inventory_unit, reason: Spree::UnitCancel::DEFAULT_REASON, whodu | |
# @return [Reimbursement] the reimbursement for inventory being canceled | ||
def reimburse_units(inventory_units, created_by: nil) | ||
unless created_by | ||
created_by = Spree.user_class.find_by(email: '[email protected]') | ||
Spree::Deprecation.warn("Calling #reimburse_units on #{self} without created_by is deprecated") | ||
end | ||
reimbursement = nil | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,7 +100,6 @@ def unpaid_amount | |
|
||
def perform!(created_by: nil) | ||
unless created_by | ||
created_by = Spree.user_class.find_by(email: '[email protected]') | ||
Spree::Deprecation.warn("Calling #perform on #{self} without created_by is deprecated") | ||
end | ||
reimbursement_tax_calculator.call(self) | ||
|
@@ -122,7 +121,6 @@ def perform!(created_by: nil) | |
|
||
def simulate(created_by: nil) | ||
unless created_by | ||
created_by = Spree.user_class.find_by(email: '[email protected]') | ||
Spree::Deprecation.warn("Calling #simulate on #{self} without created_by is deprecated") | ||
end | ||
reimbursement_simulator_tax_calculator.call(self) | ||
|
@@ -151,7 +149,6 @@ def all_exchanges? | |
# @return [void] | ||
def return_all(created_by: nil) | ||
unless created_by | ||
created_by = Spree.user_class.find_by(email: '[email protected]') | ||
Spree::Deprecation.warn("Calling #return_all on #{self} without created_by is deprecated") | ||
end | ||
return_items.each(&:accept!) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,6 @@ class << self | |
# so they can be displayed in the Admin UI appropriately. | ||
def simulate(reimbursement, created_by: nil) | ||
unless created_by | ||
created_by = Spree.user_class.find_by(email: '[email protected]') | ||
Spree::Deprecation.warn("Calling #simulate on #{self} without created_by is deprecated") | ||
end | ||
execute(reimbursement, true, created_by: created_by) | ||
|
@@ -22,7 +21,6 @@ def simulate(reimbursement, created_by: nil) | |
# Actually perform the reimbursement | ||
def perform(reimbursement, created_by: nil) | ||
unless created_by | ||
created_by = Spree.user_class.find_by(email: '[email protected]') | ||
Spree::Deprecation.warn("Calling #perform on #{self} without created_by is deprecated") | ||
end | ||
execute(reimbursement, false, created_by: created_by) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ class ReimbursementType::Credit < Spree::ReimbursementType | |
class << self | ||
def reimburse(reimbursement, return_items, simulate, created_by: nil) | ||
unless created_by | ||
created_by = Spree.user_class.find_by(email: '[email protected]') | ||
Spree::Deprecation.warn("Calling #reimburse on #{self} without created_by is deprecated") | ||
end | ||
unpaid_amount = return_items.sum(&:total).round(2, :down) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ class Spree::ReimbursementType::StoreCredit < Spree::ReimbursementType | |
class << self | ||
def reimburse(reimbursement, return_items, simulate, created_by: nil) | ||
unless created_by | ||
created_by = Spree.user_class.find_by(email: '[email protected]') | ||
Spree::Deprecation.warn("Calling #reimburse on #{self} without created_by is deprecated") | ||
end | ||
unpaid_amount = return_items.sum(&:total).to_d.round(2, :down) | ||
|