removed user from contact model and all associated logic

This commit is contained in:
David Kennedy 2024-07-02 16:59:18 -04:00
parent 5f5e487eb0
commit 45c7f1aaa6
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
10 changed files with 67 additions and 459 deletions

View file

@ -812,15 +812,15 @@ class DomainRequestDeleteView(DomainRequestPermissionDeleteView):
self.object = self.get_object()
self.object.delete()
# Delete orphaned contacts - but only for if they are not associated with a user
Contact.objects.filter(id__in=contacts_to_delete, user=None).delete()
# Delete orphaned contacts
Contact.objects.filter(id__in=contacts_to_delete).delete()
# After a delete occurs, do a second sweep on any returned duplicates.
# This determines if any of these three fields share a contact, which is used for
# the edge case where the same user may be an SO, and a submitter, for example.
if len(duplicates) > 0:
duplicates_to_delete, _ = self._get_orphaned_contacts(domain_request, check_db=True)
Contact.objects.filter(id__in=duplicates_to_delete, user=None).delete()
Contact.objects.filter(id__in=duplicates_to_delete).delete()
# Return a 200 response with an empty body
return HttpResponse(status=200)