Skip to content

Commit

Permalink
Merge pull request #822 from techmatters/CHI-3181-remove_blanked_offl…
Browse files Browse the repository at this point in the history
…ine_contacts

CHI-3181: Treat offline contacts in a 'blanked' state as deletions for the search index
  • Loading branch information
stephenhand authored Feb 4, 2025
2 parents 569a780 + 92c34e1 commit 78e66c8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion hrm-domain/hrm-core/contact/contactService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,16 @@ export const patchContact = async (
// trigger index operation but don't await for it

if (!skipSearchIndex) {
updateContactInSearchIndex({ accountSid, contactId: parseInt(contactId, 10) });
if (
updated.taskId?.startsWith('offline-contact-task-') &&
!updated.rawJson.callType &&
!updated.finalizedAt
) {
// If the task is an offline contact task and the call type is not set, this is a 'reset' contact, effectively deleted, so we should remove it from the index
deleteContactInSearchIndex({ accountSid, contactId: parseInt(contactId, 10) });
} else {
updateContactInSearchIndex({ accountSid, contactId: parseInt(contactId, 10) });
}
}

return applyTransformations(updated);
Expand Down

0 comments on commit 78e66c8

Please sign in to comment.