-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Dedupe entity_tag mangling bug #17125
Conversation
(Standard links)
|
f8215d8
to
1b67a7a
Compare
@pfigel will you be able to look at this? |
@eileenmcnaughton will take a look at this today or tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a nasty one - I'm sure we've been bitten by it but never noticed. Thanks @eileenmcnaughton!
- General standards
- (
r-explain
) PASS - (
r-user
) PASS: User would expect tags with unrelated entities not to be touched by a merge. - (
r-doc
) PASS - (
r-run
) PASS: Test scenarios:- ✅ Tag on activity where entity_id was colliding with the merged contact wasn't updated.
- ✅
civicrm_entity_file
row attached to the merged contact was updated correctly - ✅ No broader issues with merge screen/results found
- (
- Developer standards
Is there a Gitlab issue for this? |
maybe not - there was a bunch of refactors & this was found adding a test |
Overview
Fixes a bug whereby the merge script alters non-contact entity tags, changing the entity they are related to
Before
Start with a contact & an activity with the same id
Assign a contact entity tag to the contact and an activity entity tag to the activity.
Merge the contact with another contact, note that the entity_id is updated on the activity entity_tag too
After
Only the contact entity tag is updated.
Technical Details
I identified this bug in testing removing the UPDATE IGNORE + DELETE in #17072.
entity_tag is hack-added to the array of tables that interact with contact - resulting in it passing through the UPDATE without the WHERE entity_table = ...
The function with the hack-add is called from 2 places. We know it is unwanted in 1 so I moved it to the other place (being unsure if it is useful there this should give no change)
civicrm_entity_tag was missing from the array of tables that are entity_table-linked to contacts. I switched to using discovery rather than hard-coding but I added caching to limit it to once per batch script
Comments
@pfigel