twenty icon indicating copy to clipboard operation
twenty copied to clipboard

Added sanitize funtion to normalize the link input

Open SujithThirumalaisamy opened this issue 1 year ago • 4 comments

feat: add sanitizeLinkRecordInput for link normalization

Addresses issue #2546

  • Introduce a new utility function, sanitizeLinkRecordInput, to normalize link input specifically for the companies tab.
  • This function is added to packages/twenty-front/src/modules/object-record/utils/sanitizeLinkRecordInput.ts.
  • Modify existing utility function sanitizeRecordInput in packages/twenty-front/src/modules/object-record/utils/sanitizeRecordInput.ts to incorporate link sanitization logic.

Fixes: #2546

SujithThirumalaisamy avatar Jan 18 '24 17:01 SujithThirumalaisamy

Hi @SujithThirumalaisamy! Have you seen @charlesBochet's comment about how we want to address this issue? #2546 (comment) This PR seems to address the third item, would be nice if we could address the other two in the same PR as well! I can answer your questions if you need help! Thanks a lot for your contribution 🙏

EDIT: sorry I read @charlesBochet's check list too fast, he mentioned persistLinkField for the third item, not sanitizeRecordInput. @charlesBochet, is it ok if we normalize before saving as mentioned in the issue's title and as implemented in this PR? Or do we want to only normalize on field display?

I actually think we should normalize before persisting the field (it should be normalize in DB)

charlesBochet avatar Jan 24 '24 14:01 charlesBochet

Hi @SujithThirumalaisamy! Have you seen @charlesBochet's comment about how we want to address this issue? #2546 (comment) This PR seems to address the third item, would be nice if we could address the other two in the same PR as well! I can answer your questions if you need help! Thanks a lot for your contribution 🙏 EDIT: sorry I read @charlesBochet's check list too fast, he mentioned persistLinkField for the third item, not sanitizeRecordInput. @charlesBochet, is it ok if we normalize before saving as mentioned in the issue's title and as implemented in this PR? Or do we want to only normalize on field display?

I actually think we should normalize before persisting the field (it should be normalize in DB)

In this case this PR is on the right track! I would say there is no need to implement the check list items mentioned in https://github.com/twentyhq/twenty/issues/2546#issuecomment-1845621874 as normalizing domainName in sanitizeRecordInput should do the job. @SujithThirumalaisamy the 2 comments I left above are still relevant, if you can address them it would be awesome 🙏

thaisguigon avatar Jan 24 '24 14:01 thaisguigon

Thankyou for your wonderful review on this. Will work on this ASAP and will get back with the PR. Thanyou so much for you time! ❤️ @thaisguigon

SujithThirumalaisamy avatar Jan 24 '24 15:01 SujithThirumalaisamy

I have tested this jest tests in my local. Surprisingly I have got no fails. image I am confused about the fail in the CI/CD. Is this normal @thaisguigon ?

SujithThirumalaisamy avatar Jan 25 '24 08:01 SujithThirumalaisamy