Bugfix/15678 user addresses and fields #15685
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
First issue:
User‘s nested addresses owned by a custom field appear in the main Addresses view when editing that user.
Fix:
User->getAddresses()
should return user's "native" addresses - the ones linked via theaddresses
attribute and not via a custom Addresses field.The above also fixes the issue where deleting the custom Addresses field caused an error about a missing field when visiting the user's Addresses screen.
Second issue:
After deleting an Addresses field, the
fieldId
is not cleaned up, nor are the nested elements deleted. Garbage collection also doesn't clear those out.Fix:
This happens because there's no foreign key constraint on the
addresses.fieldId
field.I added a migration that will delete all the addresses that are linked to a field that's been hard deleted and then add a foreign key constraint to the
fieldId
column. I also adjusted theGc
service to run partial elements deletion on Addresses.Related issues
#15678