Skip to content
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

Deduplicate-emails #10355

Merged
merged 7 commits into from
Feb 20, 2025
Merged

Deduplicate-emails #10355

merged 7 commits into from
Feb 20, 2025

Conversation

guillim
Copy link
Contributor

@guillim guillim commented Feb 20, 2025

Following User request to remove duplicate emails

@guillim guillim self-assigned this Feb 20, 2025
@guillim guillim added scope: backend Issues that are affecting the backend side only -PR: awaiting review prio: high labels Feb 20, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR implements case-insensitive email deduplication across the contact management system, ensuring that variations of the same email address (e.g., '[email protected]' and '[email protected]') are treated as identical.

  • Added case-insensitive email handle comparison in packages/twenty-server/src/modules/contact-creation-manager/utils/get-unique-contacts-and-handles.util.ts using toLocaleLowerCase()
  • Implemented URL normalization and email case standardization in packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-runner-args.factory.ts
  • Added test cases in get-unique-contacts-and-handles.spec.ts to verify case-insensitive email deduplication
  • Enhanced error handling for both URL and email processing in the query runner factory

3 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

guillim and others added 3 commits February 20, 2025 12:07
…runner/factories/query-runner-args.factory.ts

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@guillim guillim enabled auto-merge (squash) February 20, 2025 11:10
try {
newPrimaryLinkUrl = new URL(newPrimaryLinkUrl).toString();
} catch {
newPrimaryLinkUrl = value?.primaryLinkUrl;
Copy link
Member

@charlesBochet charlesBochet Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion for long term: should this rather be part of the ORM layer so services (like messaging) or custom apps can also benefit from it?

suggestion for long term: this seems tied to validating the input + casting it. I think we need a robust approach here for FE and BE behavior. Ok with this fix for now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do the util

Copy link
Member

@charlesBochet charlesBochet Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must: this could also be extracted to an util and tested separately :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@FelixMalfait FelixMalfait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed orally:

  • let's also do secondaryLinks?
  • check company creation, do we lowercase email when extracting the domain from an email?

@guillim guillim merged commit 04a62e9 into main Feb 20, 2025
32 checks passed
@guillim guillim deleted the deduplicate-emails branch February 20, 2025 14:40
Copy link
Contributor

Thanks @guillim for your contribution!
This marks your 74th PR on the repo. You're top 1% of all our contributors 🎉
See contributor page - Share on LinkedIn - Share on Twitter

Contributions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-PR: awaiting review prio: high scope: backend Issues that are affecting the backend side only
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants