Merge pull request #13754 from deivid-rodriguez/no-changes-after-delete-customer

Properly handle changes in `code` attribute when a customer is deleted
This commit is contained in:
Filipe
2025-12-15 17:58:04 +00:00
committed by GitHub
2 changed files with 5 additions and 7 deletions

View File

@@ -38,16 +38,13 @@ angular.module("admin.indexUtils").directive "objForUpdate", (switchClass, pendi
# To ensure the customer is still updated, we check on the $destroy event to see if
# the attribute has changed, if so we queue up the change.
scope.$on '$destroy', (value) ->
# No update
return if scope.object()[scope.attr] is scope.savedValue
currentValue = scope.object()[scope.attr] || ""
# For some reason the code attribute is removed from the object when cleared, so we add
# an emptyvalue so it gets updated properly
if scope.attr is "code" and scope.object()[scope.attr] is undefined
scope.object()["code"] = ""
# No update
return if currentValue is scope.savedValue
# Queuing up change
addPendingChange(scope.attr, scope.object()[scope.attr])
addPendingChange(scope.attr, currentValue)
# private

View File

@@ -111,6 +111,7 @@ RSpec.describe 'Customers' do
end
end
expect(page).not_to have_selector "tr#c_#{customer2.id}"
expect(page).not_to have_content 'You have unsaved changes'
}.to change{ Customer.count }.by(-1)
end