Duplicates: Merged duplicates are still listed as potential duplicates
Closed this issue · 2 comments
Description
After merging a duplicate, it will be marked on the backend as merged. But it is still incorrectly listed on the frontend.
Steps to reproduce
- Go to https://app.dev.zetkin.org/organize/1/people/duplicates (and log in)
- Click on "Resolve" for any duplicate
- Click "Merge"
- Refresh the page
Expected Behaviour
The duplicate record should be taken off the list at step 3, and remain off the list in step 4.
Actual Behaviour
The duplicate is removed at step 3 (because it's removed from the cache) but then comes back in step 4. The record that remains can't load the avatars properly, because only one person record remains after the merge.
Screenshots (if you have any)
Note that this is currently only happening in production. The dev server is still running a prerelease version of the duplicates backend that isn't correctly marking any duplicates as merged, so status: "merged"
will never occur on the dev server, although it should.
I will upgrade the dev server in the next week or two so that this bug can be reproduced there.
There's two issues here:
-
When merging duplicates, it seems like the status of the duplicate object is not changed from "pending" to "merged". This might not be relevant if we instead decide to just delete the duplicate object after having merged a contact. If we want to be able to see a record of the duplicate object after it's been merged, then in addition to changing the state, we also need to be able to handle the viewing of a person that no longer exists. Currently we get a bunch of errors because we can't find the tags or the avatar of people who don't exist, we would need to add null handling to this.
-
When removing a person in a regular manner, the duplicate objects are not updated. Similar situation to above occurs. When removing a person, we should probably also remove any duplicate objects that they were part of.