fix: Contact merges now correctly merge custom items #329
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.
Not sure what branch to use as none of these branches mentioned exist, so using default.
I haven't looked at tests as there is no coverage here currently. A unit test would be useless as there is no logic here it's just building a query so it would just end up testing method calls and failing every time someone modifies the code, rather than testing the outcome. I looked at adding a functional test but I need a bit of time to get a local database setup etc. to work from so I had to move on for now. If it's required let me know but I'm unsure my availability to do it.
Description:
When two contacts with custom item relationships merge, the custom item relationships are not merged, and so the losing contact's custom items are "lost" and get removed when that losing contact is removed.
Steps to test this PR:
Create two contacts. Set the email to the same. Ensure email field is "Unique". Create several different custom items and attach different custom items to both. Now run the deduplicate contacts command. Before this patch, the winning contact only has its original custom items, none of the ones from the losing contact. With this PR, the items for both contacts end up on the winning contact.